system/flake.nix

95 lines
2.6 KiB
Nix
Raw Normal View History

2022-08-29 23:46:02 +03:00
{
inputs = {
2022-09-14 12:18:55 +03:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2022-08-29 23:46:02 +03:00
2022-10-09 14:56:08 +03:00
flake-utils.url = "github:numtide/flake-utils";
2022-09-26 03:48:38 +03:00
hardware.url = "github:NixOS/nixos-hardware/master";
2022-08-30 00:17:21 +03:00
home-manager = {
2022-09-14 12:18:55 +03:00
url = "github:nix-community/home-manager";
2022-08-30 00:17:21 +03:00
inputs.nixpkgs.follows = "nixpkgs";
};
2022-09-01 11:17:54 +03:00
2022-09-21 13:08:01 +03:00
wired = {
url = "github:Toqozz/wired-notify";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-09-01 11:17:54 +03:00
dedsec-grub-theme = {
2022-09-14 12:18:55 +03:00
url = "gitlab:VandalByte/dedsec-grub-theme";
2022-09-01 11:17:54 +03:00
inputs.nixpkgs.follows = "nixpkgs";
};
2022-09-17 21:55:13 +03:00
2022-09-18 18:29:40 +03:00
# nix lsp
nil = {
2022-09-25 17:07:41 +03:00
url = "github:oxalica/nil";
2022-09-18 18:29:40 +03:00
inputs.nixpkgs.follows = "nixpkgs";
2022-10-09 14:56:08 +03:00
inputs.flake-utils.follows = "flake-utils";
2022-09-18 18:29:40 +03:00
};
# my neovim configuration
2022-09-17 21:55:13 +03:00
myneovim = {
2022-10-08 08:39:07 +03:00
url = "git+https://git.pleshevski.ru/mynix/neovim?rev=b22dfff883978841719da99d2abbfe7afaa91e4b";
2022-09-18 18:29:40 +03:00
inputs.nixpkgs.follows = "nixpkgs";
};
# tool to change .env faster
vnetod = {
2022-09-20 09:22:19 +03:00
url = "git+https://git.pleshevski.ru/pleshevskiy/vnetod";
2022-09-17 21:55:13 +03:00
inputs.nixpkgs.follows = "nixpkgs";
};
2022-08-30 00:17:21 +03:00
};
2022-08-29 23:46:02 +03:00
2022-10-09 14:56:08 +03:00
outputs = inputs @ { self, flake-utils, nixpkgs, hardware, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib;
nixos-rebuild = pkgs.nixos-rebuild.override { nix = pkgs.nixFlakes; };
in
{
apps = lib.mapAttrs
(name: program: { type = "app"; program = toString program; })
2022-10-09 15:04:03 +03:00
(flake-utils.lib.flattenTree {
switch = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "switch-${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild switch --flake .#${hostname}
'')
self.nixosConfigurations);
});
2022-10-09 14:56:08 +03:00
devShells = {
default = pkgs.mkShell {
packages = with pkgs;
[
stylua # lua formatter
ormolu # haskell formatter
];
};
};
})
// {
2022-10-08 22:45:35 +03:00
nixosConfigurations =
nixpkgs.lib.mapAttrs
(hostname: { system
, specialArgs ? { }
, extraModules ? [ ]
, nixpkgs ? inputs.nixpkgs
}:
nixpkgs.lib.nixosSystem {
inherit system;
2022-08-30 00:17:21 +03:00
2022-10-08 22:45:35 +03:00
specialArgs = { inherit inputs; } // specialArgs;
modules =
(with inputs; [ home-manager.nixosModule ])
++ [ ./machines/${hostname} ]
++ extraModules;
})
(import ./machines inputs);
2022-08-29 23:46:02 +03:00
};
}