diff options
author | Franck Cuny <franck@fcuny.net> | 2024-12-08 15:34:45 -0800 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2024-12-08 15:36:35 -0800 |
commit | 9b4116e8f895834edada6b7c1efe787038fc0f3e (patch) | |
tree | 5648a0cfedbdfcad5f797cc3f39ecd0a33feb342 | |
parent | more refactoring (diff) | |
download | world-9b4116e8f895834edada6b7c1efe787038fc0f3e.tar.gz |
add support for devshell and pre-commit-hooks again
Diffstat (limited to '')
-rw-r--r-- | flake.lock | 132 | ||||
-rw-r--r-- | flake.nix | 54 |
2 files changed, 182 insertions, 4 deletions
diff --git a/flake.lock b/flake.lock index 1a51900..e4030df 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,81 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1728330715, + "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", + "owner": "numtide", + "repo": "devshell", + "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "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-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -57,14 +132,71 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1733665616, + "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "darwin": "darwin", + "devshell": "devshell", + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", "treefmt-nix": "treefmt-nix" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index e82e17f..e69d64c 100644 --- a/flake.nix +++ b/flake.nix @@ -18,32 +18,78 @@ url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + flake-utils.url = "github:numtide/flake-utils"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + devshell.url = "github:numtide/devshell"; + devshell.inputs.nixpkgs.follows = "nixpkgs"; }; # Output config, or config for NixOS system - outputs = { nixpkgs, darwin, ... }@inputs: - let mkSystem = import ./nix/lib/mkSystem.nix { inherit nixpkgs inputs; }; - in { + outputs = + { self + , nixpkgs + , darwin + , flake-utils + , pre-commit-hooks + , devshell + , ... + }@inputs: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ devshell.overlays.default ]; + }; + mkSystem = import ./nix/lib/mkSystem.nix { inherit nixpkgs inputs; }; + in + { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + nixpkgs-fmt.enable = true; + check-merge-conflicts.enable = true; + end-of-file-fixer.enable = true; + }; + }; + }; + + devShells.default = pkgs.devshell.mkShell { + packages = with pkgs; [ just ]; + env = [{ + name = "DEVSHELL_NO_MOTD"; + value = "1"; + }]; + }; + + # a VM running on the MacBook Air nixosConfigurations.vm-aarch64 = mkSystem "vm-aarch64" { system = "aarch64-linux"; user = "fcuny"; }; + # a VM running on the synology DS923+ nixosConfigurations.vm-synology = mkSystem "vm-synology" { system = "x86_64-linux"; user = "fcuny"; }; + # my personal MacBook Air darwinConfigurations.macbook-air-m2 = mkSystem "macbook-air-m2" { system = "aarch64-darwin"; user = "fcuny"; darwin = true; }; + # my work MacBook Pro darwinConfigurations.macbook-pro-intel = mkSystem "macbook-pro-intel" { system = "x86_64-darwin"; user = "fcuny"; darwin = true; }; - }; + }); } |