diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fb00e4a --- /dev/null +++ b/flake.nix @@ -0,0 +1,88 @@ +{ + description = "personal NixOS configurations"; + + inputs = { + # Nixpkgs, NixOS's official repo + nixpkgs.url = "github:nixos/nixpkgs/release-21.11"; + + utils.url = "github:numtide/flake-utils"; + + # We use the unstable nixpkgs repo for some packages. + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + + emacs-overlay.url = "github:nix-community/emacs-overlay"; + + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nur.url = "github:nix-community/NUR"; + + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + flake-utils.url = "github:numtide/flake-utils"; + + home-manager = { + url = "github:nix-community/home-manager/release-21.11"; + # We want home-manager to use the same set of nixpkgs as our system. + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + # Output config, or config for NixOS system + outputs = { ... }@inputs: + let lib = import ./lib { inherit inputs; }; + in { + nixosConfigurations = { + carmel = lib.mkSystem { + hostname = "carmel"; + system = "x86_64-linux"; + }; + aptos = lib.mkSystem { + hostname = "aptos"; + system = "x86_64-linux"; + }; + tahoe = lib.mkSystem { + hostname = "tahoe"; + system = "x86_64-linux"; + }; + }; + } // inputs.utils.lib.eachDefaultSystem (system: + let + pkgs = import inputs.nixpkgs { inherit system; }; + home-manager = inputs.home-manager.defaultPackage."${system}"; + in { + packages = pkgs // { + inherit home-manager; + + # nix run .#dnsupdate + dnsupdate = pkgs.writers.writeBashBin "dnsupdate" '' + #!/usr/bin/env bash + export TS_API_KEY=$(pass api/api.tailscale.com) + export GOOGLE_APPLICATION_CREDENTIALS=/run/agenix/gcloud/world-nix + go run ./cmd/dnsupdate/ + ''; + }; + + checks = { + pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + nixpkgs-fmt.enable = true; + shellcheck.enable = true; + }; + }; + }; + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + nixUnstable + nixfmt + rnix-lsp + home-manager + git + go + gopls + ]; + }; + }); +} |