From 692bdf36862debfe87b6ee1fbceebbe3142b7aa9 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 5 Aug 2023 14:36:01 +0530 Subject: [PATCH] flake-utilsify --- flake.lock | 40 ++++++++++++++-- flake.nix | 136 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 115 insertions(+), 61 deletions(-) diff --git a/flake.lock b/flake.lock index 9eaf831..13e2268 100644 --- a/flake.lock +++ b/flake.lock @@ -116,6 +116,24 @@ "inputs": { "systems": "systems_3" }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_4" + }, "locked": { "lastModified": 1685518550, "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", @@ -213,7 +231,7 @@ "inputs": { "flake-compat": "flake-compat", "flake-parts": "flake-parts", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ], @@ -284,7 +302,7 @@ "nixvim": { "inputs": { "beautysh": "beautysh", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixpkgs" ], @@ -334,7 +352,7 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "gitignore": "gitignore_2", "nixpkgs": [ "nixvim", @@ -389,6 +407,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "home-manager": "home-manager", "impermanence": "impermanence", "lanzaboote": "lanzaboote", @@ -441,6 +460,21 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1678901627, diff --git a/flake.nix b/flake.nix index e3d1f25..aa21c18 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,10 @@ url = "github:NixOS/nixpkgs/nixos-unstable"; }; + flake-utils = { + url = "github:numtide/flake-utils"; + }; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -29,73 +33,89 @@ outputs = { self, nixpkgs, + flake-utils, home-manager, impermanence, lanzaboote, nixvim, } @ inputs: let secrets = import ./secrets.nix; - in { - formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".alejandra; - nixosConfigurations = { - Skipper = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - }; - overlays = [(import ./packages)]; - }; - specialArgs = inputs // {inherit secrets;}; - modules = [ - { - system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; - } - - home-manager.nixosModules.home-manager - impermanence.nixosModules.impermanence - lanzaboote.nixosModules.lanzaboote - - ./common - ./hosts/skipper - - { - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - extraSpecialArgs = {inherit secrets;}; - users.${secrets.users.primary.userName} = {pkgs, ...}: { - imports = [ - impermanence.nixosModules.home-manager.impermanence - nixvim.homeManagerModules.nixvim - ./home - ]; - }; + in + { + nixosConfigurations = { + Skipper = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; }; - } - ]; + overlays = [(import ./packages)]; + }; + specialArgs = inputs // {inherit secrets;}; + modules = [ + { + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + } + + home-manager.nixosModules.home-manager + impermanence.nixosModules.impermanence + lanzaboote.nixosModules.lanzaboote + + ./common + ./hosts/skipper + + { + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = {inherit secrets;}; + users.${secrets.users.primary.userName} = {pkgs, ...}: { + imports = [ + impermanence.nixosModules.home-manager.impermanence + nixvim.homeManagerModules.nixvim + ./home + ]; + }; + }; + } + ]; + }; + Rico2 = nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; + specialArgs = inputs // {inherit secrets;}; + modules = [ + { + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + } + + nixvim.nixosModules.nixvim + + ./common + ./hosts/rico2 + ]; + }; }; - Rico2 = nixpkgs.lib.nixosSystem rec { - system = "aarch64-linux"; + } + // flake-utils.lib.eachDefaultSystem ( + system: let pkgs = import nixpkgs { inherit system; - config = { - allowUnfree = true; - }; }; - specialArgs = inputs // {inherit secrets;}; - modules = [ - { - system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; - } - - nixvim.nixosModules.nixvim - - ./common - ./hosts/rico2 - ]; - }; - }; - }; + in + with pkgs; { + formatter = pkgs.alejandra; + devShells.default = mkShell { + buildInputs = [ + git-crypt + ]; + }; + } + ); }