From 2ce46f1cf583d63ffa114c9b21318f79a10f339c Mon Sep 17 00:00:00 2001 From: iofq Date: Sun, 28 Jan 2024 16:13:13 -0600 Subject: [PATCH] test --- .envrc | 1 + flake.lock | 125 ++++++++++++++++++ flake.nix | 78 ++++++----- .../shared/programs/shell/default.nix | 1 + nixos/htz/vms/vm-test.nix | 2 +- 5 files changed, 173 insertions(+), 34 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/flake.lock b/flake.lock index 5f77a8b..4bcd3ba 100755 --- a/flake.lock +++ b/flake.lock @@ -120,6 +120,22 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -225,6 +241,24 @@ "type": "github" } }, + "flake-utils_5": { + "inputs": { + "systems": "systems_7" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "foundry-nix": { "inputs": { "flake-utils": "flake-utils", @@ -245,6 +279,27 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "haumea": { "inputs": { "nixpkgs": [ @@ -448,6 +503,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1704874635, + "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1704161960, @@ -493,6 +564,22 @@ "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1704842529, + "narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nvim": { "inputs": { "flake-utils": "flake-utils_4", @@ -539,6 +626,28 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_5", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_4", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1706424699, + "narHash": "sha256-Q3RBuOpZNH2eFA1e+IHgZLAOqDD9SKhJ/sszrL8bQD4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "deploy-rs": "deploy-rs", @@ -548,6 +657,7 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_3", "nvim": "nvim", + "pre-commit-hooks": "pre-commit-hooks", "tfa": "tfa" } }, @@ -656,6 +766,21 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tfa": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 2a6dc35..e797553 100755 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; deploy-rs.url = "github:serokell/deploy-rs"; + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -23,8 +24,8 @@ inputs.foundry-nix.url = "github:shazow/foundry.nix"; }; microvm = { - url = "github:astro/microvm.nix"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "github:astro/microvm.nix"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, home-manager, nixos-hardware, nvim, ethereum-nix, deploy-rs, ... } @inputs: @@ -46,37 +47,48 @@ in { nixosConfigurations = ( import ./nixos { inherit inputs pkgs attrs system ethereum-nix; } - ); - homeConfigurations = ( - import ./home-manager { inherit inputs pkgs attrs; } ); - deploy.nodes = { - htz = { - hostname = "htz"; - sshUser = "root"; - remoteBuild = true; - profiles.system = { - user = "root"; - path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.htz; + homeConfigurations = ( + import ./home-manager { inherit inputs pkgs attrs; } + ); + deploy.nodes = { + htz = { + hostname = "htz"; + sshUser = "root"; + remoteBuild = true; + profiles.system = { + user = "root"; + path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.htz; + }; + }; + racknerd = { + hostname = "racknerd"; + sshUser = "e"; + remoteBuild = true; + profiles.system = { + user = "root"; + path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.rknrd; + }; + }; + }; + checks = { + pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + typos.enable = true; + alejandra.enable = true; + deadnix.enable = true; + statix.enable = true; + }; + }; + }; + devShells.${system}.default = pkgs.mkShell { + buildInputs = [ + pkgs.nix + pkgs.home-manager + pkgs.git + deploy-rs.packages.${system}.deploy-rs + ]; }; }; - racknerd = { - hostname = "racknerd"; - sshUser = "e"; - remoteBuild = true; - profiles.system = { - user = "root"; - path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.rknrd; - }; - }; - }; - devShells.${system}.default = pkgs.mkShell { - buildInputs = [ - pkgs.nix - pkgs.home-manager - pkgs.git - deploy-rs.packages.${system}.deploy-rs - ]; - }; - }; -} + } diff --git a/home-manager/shared/programs/shell/default.nix b/home-manager/shared/programs/shell/default.nix index 706e84e..2716a43 100755 --- a/home-manager/shared/programs/shell/default.nix +++ b/home-manager/shared/programs/shell/default.nix @@ -3,6 +3,7 @@ imports = [ ./tmux.nix ./git.nix + ./direnv.nix ]; programs.bash = { enable = true; diff --git a/nixos/htz/vms/vm-test.nix b/nixos/htz/vms/vm-test.nix index ca86b51..4734769 100644 --- a/nixos/htz/vms/vm-test.nix +++ b/nixos/htz/vms/vm-test.nix @@ -1,4 +1,4 @@ -{ addressList, ... }: { +{ ... }: { networking.firewall = { enable = true; allowedTCPPorts = [80];