nixos-config/flake.nix

64 lines
1.6 KiB
Nix
Raw Normal View History

2021-03-31 22:15:08 +00:00
{
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
2022-10-26 03:39:52 +00:00
inputs.impermanence.url = "github:nix-community/impermanence";
2021-04-06 03:11:17 +00:00
2022-10-26 03:39:52 +00:00
outputs = { self, nixpkgs, impermanence, ... }:
2021-08-20 17:40:05 +00:00
let
2022-12-20 04:55:11 +00:00
inherit (nixpkgs) lib;
2021-11-18 20:45:24 +00:00
mypkgs = pkgs:
2022-12-20 04:55:11 +00:00
(lib.mapAttrs'
(name: type: {
2022-12-20 04:55:11 +00:00
name = lib.removeSuffix ".nix" name;
value = pkgs.callPackage (./pkgs + "/${name}") { };
})
(builtins.readDir ./pkgs));
2022-12-20 04:55:11 +00:00
forAllSystems = lib.genAttrs [ "x86_64-linux" ];
2021-11-18 20:45:24 +00:00
2021-11-22 05:38:03 +00:00
pins = {
nix.registry.nixpkgs.to = {
inherit (nixpkgs) rev;
owner = "NixOS";
repo = "nixpkgs";
type = "github";
};
2021-11-18 20:45:24 +00:00
nix.registry.bck.to = {
owner = "buckley310";
repo = "nixos-config";
type = "github";
};
};
2022-06-15 02:52:14 +00:00
mods =
{
inherit pins;
2022-10-26 03:39:52 +00:00
inherit (impermanence.nixosModules) impermanence;
2022-06-15 02:52:14 +00:00
pkgs.nixpkgs.overlays = [ (_: mypkgs) ];
} //
2022-12-20 04:55:11 +00:00
lib.mapAttrs'
2021-09-10 04:42:41 +00:00
(name: type: {
2022-12-20 04:55:11 +00:00
name = lib.removeSuffix ".nix" name;
2021-09-10 04:42:41 +00:00
value = import (./modules + "/${name}");
})
(builtins.readDir ./modules);
2021-06-12 01:32:23 +00:00
2022-06-15 02:52:14 +00:00
in
{
2022-09-18 18:39:23 +00:00
lib = {
2023-06-01 21:24:44 +00:00
gen-iso = import lib/gen-iso.nix lib;
2023-03-17 04:21:32 +00:00
gen-ssh-config = import lib/gen-ssh-config.nix lib;
2023-05-31 20:50:26 +00:00
ssh-keys = import lib/ssh-keys.nix;
2022-09-18 18:39:23 +00:00
};
2022-06-15 02:52:14 +00:00
nixosModules = mods // { default.imports = builtins.attrValues mods; };
2021-06-05 06:22:38 +00:00
2022-06-17 03:30:12 +00:00
nixosConfigurations = builtins.mapAttrs
2022-12-20 04:55:11 +00:00
(_: lib.nixosSystem)
2022-06-17 17:06:41 +00:00
(import ./hosts self.nixosModules.default);
2021-06-05 06:22:38 +00:00
2022-05-04 17:34:39 +00:00
packages = forAllSystems (system:
mypkgs nixpkgs.legacyPackages.${system});
};
2021-03-31 22:15:08 +00:00
}