feat: empty flake, reduce lockfile, flake-utils-plus

This commit is contained in:
Kat Inskip 2022-12-03 17:54:34 +01:00
parent b4249f0cd0
commit c4033ff00a
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
3 changed files with 153 additions and 103 deletions

View file

@ -1,4 +1,4 @@
{ nixpkgs, darwin, home-manager, ragenix, scalpel, ... }@inputs: let { self, utils, nixpkgs, darwin, home-manager, ragenix, scalpel, mach-nix, ... }@inputs: let
tree = (inputs.tree.tree { tree = (inputs.tree.tree {
inherit inputs; inherit inputs;
folder = ./.; folder = ./.;
@ -16,38 +16,54 @@
}).impure; }).impure;
lib = inputs.nixpkgs.lib; lib = inputs.nixpkgs.lib;
inherit (lib.attrsets) mapAttrs; inherit (lib.attrsets) mapAttrs;
in { inherit (lib.lists) singleton;
inherit tree; in utils.lib.mkFlake {
nixosConfigurations = let base = mapAttrs (name: path: nixpkgs.lib.nixosSystem { inherit self inputs;
specialArgs = { supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
inherit inputs tree; channelsConfig.allowUnfree = true;
machine = name;
}; hostDefaults = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
ragenix.nixosModule ragenix.nixosModule
path
]; ];
} ) tree.nixos.systems; in mapAttrs (_: sys: sys.extendModules { extraArgs = {
inherit utils inputs tree;
};
};
hosts = let
outputForSystem = system: {
"x86_64-linux" = "nixosConfigurations";
"aarch64-darwin" = "darwinConfigurations";
}.${system};
builderForSystem = system: {
"x86_64-linux" = nixpkgs.lib.nixosSystem;
"aarch64-darwin" = darwin.lib.darwinSystem;
}.${system};
mapSystem = system: name: path: {
inherit system;
output = outputForSystem system;
builder = builderForSystem system;
modules = singleton path;
extraArgs = {
machine = name;
};
};
in mapAttrs (mapSystem "x86_64-linux") tree.nixos.systems
// mapAttrs (mapSystem "aarch64-darwin") tree.darwin.systems;
outputsBuilder = channels: {
nixosConfigurations = mapAttrs(_: sys: sys.extendModules {
modules = [ scalpel.nixosModule ]; modules = [ scalpel.nixosModule ];
specialArgs = { specialArgs = {
prev = sys; prev = sys;
}; };
} ) base; }) self.nixosConfigurations;
darwinConfigurations = mapAttrs (name: path: darwin.lib.darwinSystem {
specialArgs = {
inherit inputs tree;
machine = name;
};
system = "aarch64-darwin";
modules = [
home-manager.nixosModules.home-manager
path
];
} ) tree.darwin.systems;
homeManagerConfigurations = mapAttrs (name: path: home-manager.lib.homeManagerConfiguration { homeManagerConfigurations = mapAttrs (name: path: home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = channels.nixpkgs;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs tree; inherit inputs tree;
machine = name; machine = name;
@ -57,4 +73,15 @@ in {
path path
]; ];
}) tree.home; }) tree.home;
inherit tree;
};
devShells = {
"python" = mach-nix.mkPythonShell {
python = "python310";
requirements = ''
'';
};
};
} }

163
flake.lock generated
View file

@ -42,13 +42,28 @@
"type": "github" "type": "github"
} }
}, },
"empty": {
"locked": {
"lastModified": 1630400035,
"narHash": "sha256-MWaVOCzuFwp09wZIW9iHq5wWen5C69I940N1swZLEQ0=",
"owner": "input-output-hk",
"repo": "empty-flake",
"rev": "2040a05b67bf9a669ce17eca56beb14b4206a99a",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"repo": "empty-flake",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1644229661,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -65,11 +80,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1669825171, "lastModified": 1670058827,
"narHash": "sha256-HxlZHSiRGXnWAFbIJMeujqBe2KgACYx5XDRY0EA9P+4=", "narHash": "sha256-T+yyncPpZWeIkFrG/Cgj21iopULY3BZGWIhcT5ZmCgM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "478610aa37c8339eacabfa03f07dacf5574edd47", "rev": "eb3598cf44aa10f2a16fe38488a102c0f474d766",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -79,13 +94,37 @@
"type": "github" "type": "github"
} }
}, },
"mach-nix": {
"inputs": {
"flake-utils": [
"utils"
],
"nixpkgs": [
"nixpkgs"
],
"pypi-deps-db": "pypi-deps-db"
},
"locked": {
"lastModified": 1654084003,
"narHash": "sha256-j/XrVVistvM+Ua+0tNFvO5z83isL+LBgmBi9XppxuKA=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "7e14360bde07dcae32e5e24f366c83272f52923f",
"type": "github"
},
"original": {
"id": "mach-nix",
"ref": "3.5.0",
"type": "indirect"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1669791787, "lastModified": 1669969257,
"narHash": "sha256-KBfoA2fOI5+wCrm7PR+j7jHqXeTkVRPQ0m5fcKchyuU=", "narHash": "sha256-mOS13sK3v+kfgP+1Mh56ohiG8uVhLHAo7m/q9kqAehc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e76c78d20685a043d23f5f9e0ccd2203997f1fb1", "rev": "b72b8b94cf0c012b0252a9100a636cad69696666",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -95,51 +134,19 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-21_11": { "pypi-deps-db": {
"flake": false,
"locked": { "locked": {
"lastModified": 1654346688, "lastModified": 1643877077,
"narHash": "sha256-Y7QtZkfdxTvACCvWmDjpN6qOf4OKkZATufHcJP2VMKM=", "narHash": "sha256-jv8pIvRFTP919GybOxXE5TfOkrjTbdo9QiCO1TD3ZaY=",
"owner": "NixOS", "owner": "DavHau",
"repo": "nixpkgs", "repo": "pypi-deps-db",
"rev": "2de556c4cd46a59e8ce2f85ee4dd400983213d45", "rev": "da53397f0b782b0b18deb72ef8e0fb5aa7c98aa3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "DavHau",
"ref": "release-21.11", "repo": "pypi-deps-db",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-22_05": {
"locked": {
"lastModified": 1654373220,
"narHash": "sha256-3vKFnZz2oYHo4YcelaNOhO4XQ2jiIEXrp1s4w+e773c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d6cb04299ce8964290ae7fdcb87aa50da0500b5c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1654245945,
"narHash": "sha256-PV6MZ+HuNnyLxQGa2rwt0BmCRkQS2xqhc+SeJLQM+WU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "442db9429b9fbdb6352cfb937afc8ecccfe2633f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
@ -147,7 +154,7 @@
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"flake-utils": [ "flake-utils": [
"flake-utils" "utils"
], ],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -171,12 +178,14 @@
"root": { "root": {
"inputs": { "inputs": {
"darwin": "darwin", "darwin": "darwin",
"flake-utils": "flake-utils", "empty": "empty",
"home-manager": "home-manager", "home-manager": "home-manager",
"mach-nix": "mach-nix",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"ragenix": "ragenix", "ragenix": "ragenix",
"scalpel": "scalpel", "scalpel": "scalpel",
"tree": "tree" "tree": "tree",
"utils": "utils_2"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -209,7 +218,9 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"sops-nix": "sops-nix" "sops-nix": [
"empty"
]
}, },
"locked": { "locked": {
"lastModified": 1655566736, "lastModified": 1655566736,
@ -225,26 +236,6 @@
"type": "github" "type": "github"
} }
}, },
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"nixpkgs-21_11": "nixpkgs-21_11",
"nixpkgs-22_05": "nixpkgs-22_05"
},
"locked": {
"lastModified": 1654401128,
"narHash": "sha256-uCdQ2fzIPGakHw2TkvOncUvCl7Fo7z/vagpDWYooO7s=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "f075361ecbde21535b38e41dfaa28a28f160855c",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"tree": { "tree": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -252,11 +243,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1669922720, "lastModified": 1670085069,
"narHash": "sha256-xzoKL4RtKRECdrWHAM14OBaNdJRToc+AA9zmUWuo5eY=", "narHash": "sha256-IO9HcAjncPp/0sUGcCUWVwa0XoBVFQKx+oY+8EBRcTc=",
"owner": "kittywitch", "owner": "kittywitch",
"repo": "tree", "repo": "tree",
"rev": "fbe8ae96d7f4fb369d32dbbe8434606b23354caf", "rev": "501675588cb663a9bd18056002de697f4e91b667",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -279,6 +270,24 @@
"repo": "flake-utils", "repo": "flake-utils",
"type": "github" "type": "github"
} }
},
"utils_2": {
"inputs": {
"flake-utils": "flake-utils"
},
"locked": {
"lastModified": 1657226504,
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -1,6 +1,7 @@
{ {
description = "kat's personal system flakes"; description = "kat's personal system flakes";
inputs = { inputs = {
empty.url = "github:input-output-hk/empty-flake";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
@ -10,7 +11,7 @@
url = "github:lnl7/nix-darwin/master"; url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
flake-utils.url = "github:numtide/flake-utils"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
tree = { tree = {
url = "github:kittywitch/tree"; url = "github:kittywitch/tree";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -19,12 +20,25 @@
url = "github:yaxitech/ragenix"; url = "github:yaxitech/ragenix";
inputs = { inputs = {
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils"; flake-utils.follows = "utils";
}; };
}; };
scalpel = { scalpel = {
url = "github:polygon/scalpel"; url = "github:polygon/scalpel";
inputs.nixpkgs.follows = "nixpkgs"; inputs = {
nixpkgs.follows = "nixpkgs";
# i get that you have to test shit, but isn't throwing sops-nix and thus three
# whole fucking versions of nixpkgs into shit a little excessive?
# fuck the sops-nix people to begin with :/
sops-nix.follows = "empty";
};
};
mach-nix = {
url = "mach-nix/3.5.0";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "utils";
};
}; };
}; };
outputs = { ... }@inputs: import ./default.nix inputs; outputs = { ... }@inputs: import ./default.nix inputs;