123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- {
- description = "NixOS configuration";
- inputs = {
- nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
- # nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
- nixpkgs.follows = "nixpkgs-stable";
- nixos-hardware.url = "github:NixOS/nixos-hardware/master";
- flake-programs-sqlite = {
- url = "github:wamserma/flake-programs-sqlite";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- home-manager = {
- url = "github:nix-community/home-manager/release-24.05";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- impermanence.url = "github:nix-community/impermanence";
- disko = {
- url = "github:nix-community/disko/c8760cee70cf166ad6bcee0bd9f0bba934a3a651";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- deploy-rs = {
- url = "github:serokell/deploy-rs";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- agenix = {
- url = "github:ryantm/agenix";
- inputs = {
- darwin.follows = "";
- home-manager.follows = "home-manager";
- nixpkgs.follows = "nixpkgs";
- };
- };
- };
- outputs = inputs @ { self, nixpkgs, nixos-hardware, ... }:
- let inherit (import ./lib.nix { inherit inputs; })
- forAllSystems isDir listDir asAttrs mkSystem deployPkgs;
- in {
- modules = builtins.listToAttrs (builtins.map (s: {
- name = builtins.baseNameOf s;
- value = asAttrs "\\.nix" s;
- }) (builtins.filter isDir (listDir ./modules))) // {
- secrets = asAttrs "\\.age" ./secrets;
- };
- overlays = builtins.mapAttrs (_: import) (asAttrs "\\.nix" ./overlays);
- devShells = forAllSystems (system:
- with import nixpkgs {
- inherit system;
- overlays = builtins.attrValues self.overlays;
- }; {
- default = mkShell {
- nativeBuildInputs = with pkgs; [
- inputs.agenix.packages.${system}.agenix
- inputs.home-manager.packages.${system}.home-manager
- deploy-rs
- disko
- nixos-anywhere
- vim-with-vimrc
- ];
- };
- });
- packages = nixpkgs.lib.recursiveUpdate (forAllSystems (system:
- with import nixpkgs { inherit system; }; {
- default = writeShellScriptBin "fmt-check" ''
- ${deadnix}/bin/deadnix ${self}
- ${statix}/bin/statix check -i hardware-configuration.nix -- ${self}
- '';
- })) (import ./packages.nix { inherit inputs; });
- nixosConfigurations = {
- makai = mkSystem "x86_64-linux" [
- nixos-hardware.nixosModules.common-cpu-intel
- nixos-hardware.nixosModules.common-gpu-intel-sandy-bridge
- nixos-hardware.nixosModules.common-pc-laptop-hdd
- ./hosts/makai
- ];
- shrine = mkSystem "x86_64-linux" [
- nixos-hardware.nixosModules.common-cpu-intel
- nixos-hardware.nixosModules.common-pc-laptop-ssd
- ./hosts/shrine
- ];
- yama = mkSystem "x86_64-linux" [
- nixos-hardware.nixosModules.common-cpu-amd
- nixos-hardware.nixosModules.common-pc-ssd
- ./hosts/yama
- ];
- blackberry = mkSystem "x86_64-linux" [
- nixos-hardware.nixosModules.common-cpu-intel
- nixos-hardware.nixosModules.common-pc-ssd
- inputs.disko.nixosModules.disko
- ./hosts/blackberry
- ];
- };
- deploy.nodes = {
- blackberry = { # fail2banana.ru
- hostname = "10.0.0.50";
- profiles.system = {
- sshUser = "slark";
- user = "root";
- path = deployPkgs.x86_64-linux.deploy-rs.lib.activate.nixos self.nixosConfigurations.blackberry;
- };
- };
- };
- checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
- };
- }
|