nixos-config/flake.nix

70 lines
1.9 KiB
Nix
Raw Normal View History

2021-03-31 22:15:08 +00:00
{
2021-11-30 07:24:32 +00:00
inputs.nixpkgs.url = "nixpkgs/nixos-21.11";
2022-01-02 21:37:05 +00:00
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware";
2021-04-06 03:11:17 +00:00
2022-01-02 21:37:05 +00:00
outputs = { self, nixpkgs, nixos-hardware, ... }:
2021-08-20 17:40:05 +00:00
let
2021-11-18 20:45:24 +00:00
2021-11-01 18:45:18 +00:00
mypkgs = import ./pkgs;
2021-12-27 18:21:16 +00:00
deploy = import lib/deploy.nix;
2022-01-02 21:37:05 +00:00
hardware =
nixos-hardware.nixosModules //
import lib/hardware.nix "${nixpkgs}/nixos/modules";
2021-11-29 07:05:40 +00:00
forAllSystems = f: builtins.listToAttrs (map
(name: { inherit name; value = f name; })
2021-12-27 18:21:16 +00:00
[ "x86_64-linux" "aarch64-linux" ]);
2021-11-18 20:45:24 +00:00
2021-11-22 05:38:03 +00:00
pins = {
2021-11-18 20:45:24 +00:00
nix.registry.nixpkgs.flake = nixpkgs;
nix.registry.bck.to = {
owner = "buckley310";
repo = "nixos-config";
type = "github";
};
};
2021-08-20 17:40:05 +00:00
in
2021-06-05 06:22:38 +00:00
{
2021-12-27 18:21:16 +00:00
lib = { inherit forAllSystems hardware deploy; };
2021-11-29 07:05:40 +00:00
2021-09-10 04:42:41 +00:00
nixosModules =
2021-12-04 02:45:41 +00:00
{ inherit pins; } //
2021-09-10 04:42:41 +00:00
nixpkgs.lib.mapAttrs'
(name: type: {
2021-10-08 17:31:06 +00:00
name = nixpkgs.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
2021-11-22 05:38:03 +00:00
nixosModule = {
2021-08-16 03:20:11 +00:00
imports = builtins.attrValues self.nixosModules;
2021-08-20 17:40:05 +00:00
nixpkgs.overlays = [ (_: mypkgs) ];
2021-08-16 03:20:11 +00:00
};
2021-06-05 06:22:38 +00:00
2021-12-10 06:34:46 +00:00
nixosConfigurations = import ./hosts nixpkgs hardware self.nixosModule;
2021-06-05 06:22:38 +00:00
2021-11-29 07:05:40 +00:00
packages = forAllSystems
2021-08-20 17:40:05 +00:00
(system: mypkgs nixpkgs.legacyPackages.${system});
2021-06-12 02:41:50 +00:00
2021-11-29 07:05:40 +00:00
apps = forAllSystems (system:
2021-06-25 05:04:30 +00:00
with nixpkgs.legacyPackages.${system};
2021-06-12 02:41:50 +00:00
{
2021-11-05 18:02:48 +00:00
gnome-extensions = writeShellScriptBin "gnome-extensions" ''
cat ${path}/pkgs/desktops/gnome/extensions/extensions.json |
${jq}/bin/jq -c '.[]|{name,ver:(.shell_version_map|keys)}'
'';
2021-11-05 18:04:19 +00:00
jupyterlab =
let
jupy = python3.withPackages (p: with p; [ jupyterlab ipython ]);
in
writeShellScriptBin "jupyterlab" ''
exec ${jupy}/bin/python -m jupyterlab "$@"
'';
2021-06-25 05:04:30 +00:00
}
);
};
2021-03-31 22:15:08 +00:00
}