From 918859b31f329773cba814b784deefc39be86543 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Mon, 10 Apr 2023 23:07:41 +0530 Subject: [PATCH] setup initial build for rico --- flake.lock | 16 +++++++ flake.nix | 67 ++++++++++++++++++----------- nix.nix | 3 +- system.rico/default.nix | 31 +++++++++++++ system.rico/hardware/default.nix | 3 ++ system.rico/hardware/filesystem.nix | 8 ++++ 6 files changed, 102 insertions(+), 26 deletions(-) create mode 100644 system.rico/default.nix create mode 100644 system.rico/hardware/default.nix create mode 100644 system.rico/hardware/filesystem.nix diff --git a/flake.lock b/flake.lock index 211fdd6..1ae0ec1 100644 --- a/flake.lock +++ b/flake.lock @@ -331,6 +331,21 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1680876084, + "narHash": "sha256-eP9yxP0wc7XuVaODugh+ajgbFGaile2O1ihxiLxOuvU=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "3006d2860a6ed5e01b0c3e7ffb730e9b293116e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1681036984, @@ -522,6 +537,7 @@ "hyprland": "hyprland", "impermanence": "impermanence", "lanzaboote": "lanzaboote", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixvim": "nixvim" } diff --git a/flake.nix b/flake.nix index f6ea657..d5bd287 100644 --- a/flake.nix +++ b/flake.nix @@ -25,39 +25,58 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nixos-hardware = { + url = "github:NixOS/nixos-hardware"; + }; + nixvim = { url = "github:pta2002/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, home-manager, hyprland, impermanence, lanzaboote, nixvim }@inputs: - let - system = "x86_64-linux"; - lib = nixpkgs.lib; - in - { - formatter.${system} = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; - nixosConfigurations = { - Skipper = lib.nixosSystem { - specialArgs = inputs; - modules = [ - ./nix.nix + outputs = { self, nixpkgs, home-manager, hyprland, impermanence, lanzaboote, nixos-hardware, nixvim }@inputs: { + formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".nixpkgs-fmt; + formatter."aarch64-linux" = nixpkgs.legacyPackages."aarch64-linux".nixpkgs-fmt; + nixosConfigurations = { + Skipper = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + ./nix.nix - { - nixpkgs.overlays = [ (import ./packages) hyprland.overlays.default ]; - system.configurationRevision = lib.mkIf (self ? rev) self.rev; - } + { + nixpkgs.overlays = [ (import ./packages) hyprland.overlays.default ]; + nixpkgs.hostPlatform = nixpkgs.lib.mkDefault "x86_64-linux"; + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + } - home-manager.nixosModules.home-manager - impermanence.nixosModules.impermanence - lanzaboote.nixosModules.lanzaboote + home-manager.nixosModules.home-manager + impermanence.nixosModules.impermanence + lanzaboote.nixosModules.lanzaboote - ./system - ./users - ./home - ]; - }; + ./system + ./users + ./home + ]; + }; + Rico2 = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + specialArgs = inputs; + modules = [ + ./nix.nix + + { + nixpkgs.hostPlatform = nixpkgs.lib.mkDefault "aarch64-linux"; + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + } + + nixos-hardware.nixosModules.raspberry-pi-4 + + ./users + ./system.rico + ]; }; }; + }; } diff --git a/nix.nix b/nix.nix index 5bb8fcd..dbc3829 100644 --- a/nix.nix +++ b/nix.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{ ... }: { nix.settings = { substituters = [ "https://nix-community.cachix.org/" @@ -10,5 +10,4 @@ experimental-features = [ "nix-command" "flakes" ]; }; nixpkgs.config.allowUnfree = true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/system.rico/default.nix b/system.rico/default.nix new file mode 100644 index 0000000..5bbb449 --- /dev/null +++ b/system.rico/default.nix @@ -0,0 +1,31 @@ +{ ... }: { + + imports = [ + ./hardware + ]; + + networking.hostName = "Rico2"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + LC_ALL = "en_US.UTF-8"; + }; + supportedLocales = [ "en_US.UTF-8/UTF-8" ]; + }; + + programs.zsh.enable = true; + services.openssh.enable = true; + + time.timeZone = "Asia/Kolkata"; + system.stateVersion = "23.05"; +} diff --git a/system.rico/hardware/default.nix b/system.rico/hardware/default.nix new file mode 100644 index 0000000..f768ed0 --- /dev/null +++ b/system.rico/hardware/default.nix @@ -0,0 +1,3 @@ +{ ... }: { + imports = [ ./filesystem.nix ]; +} diff --git a/system.rico/hardware/filesystem.nix b/system.rico/hardware/filesystem.nix new file mode 100644 index 0000000..49137e7 --- /dev/null +++ b/system.rico/hardware/filesystem.nix @@ -0,0 +1,8 @@ +{ ... }: { + + fileSystems."/" = { + device = "/dev/disk/by-label/NIXOS_SD"; + fsType = "ext4"; + options = [ "noatime" ]; + }; +}