From 8b89517325f26da224ca32212cc692dddb8ad63a Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Thu, 20 Jul 2023 13:48:15 +1000 Subject: [PATCH] nix: basic working flake --- .envrc | 2 + .gitignore | 1 - flake.lock | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 12 +++++ outputs.nix | 20 +++++++ shell.nix | 14 +++++ 6 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 outputs.nix create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..005a801 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake +watch_file flake.nix diff --git a/.gitignore b/.gitignore index b1e513a..b30a22a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *.swp .direnv -.envrc Deployments/syncserver.nix examples result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ba7fbd3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,148 @@ +{ + "nodes": { + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1677045134, + "narHash": "sha256-jUc2ccTR8f6MGY2pUKgujm+lxSPNGm/ZAP+toX+nMNc=", + "owner": "NixOS", + "repo": "nix", + "rev": "4acc684ef7b3117c6d6ac12837398a0008a53d85", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "2.13.3", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1670461440, + "narHash": "sha256-jy1LB8HOMKGJEGXgzFRLDU1CBGL0/LlkolgnqIsF0D8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "04a75b2eecc0acf6239acf9dd04485ff8d14f425", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgsUnstable": { + "locked": { + "lastModified": 1689679375, + "narHash": "sha256-LHUC52WvyVDi9PwyL1QCpaxYWBqp4ir4iL6zgOkmcb8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "684c17c429c42515bafb3ad775d2a710947f3d67", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1689680872, + "narHash": "sha256-brNix2+ihJSzCiKwLafbyejrHJZUP0Fy6z5+xMOC27M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "08700de174bc6235043cb4263b643b721d936bdb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nix": "nix", + "nixpkgs": "nixpkgs_2", + "nixpkgsUnstable": "nixpkgsUnstable", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0ad1d6d --- /dev/null +++ b/flake.nix @@ -0,0 +1,12 @@ +{ + description = "mio-ops deployment"; + + inputs = { + nix.url = "github:NixOS/nix/?ref=2.13.3"; + nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-23.05; + nixpkgsUnstable.url = github:NixOS/nixpkgs/?ref=nixos-unstable; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = {...} @ args: import ./outputs.nix args; +} diff --git a/outputs.nix b/outputs.nix new file mode 100644 index 0000000..68c116c --- /dev/null +++ b/outputs.nix @@ -0,0 +1,20 @@ +{ + self, + nix, + nixpkgs, + nixpkgsUnstable, + utils, + ... +} @ inputs: +(utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages."${system}"; +in { + devShell = + pkgs.callPackage + ./shell.nix { + inherit (nix.packages."${pkgs.system}") nix; + inherit (nixpkgsUnstable.legacyPackages."${pkgs.system}") alejandra; + }; +})) +// { +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..8361334 --- /dev/null +++ b/shell.nix @@ -0,0 +1,14 @@ +{ + pkgs ? import {}, + mkShell, + nix, +}: +with pkgs; + mkShell { + buildInputs = [ + alejandra # The Uncompromising Nix Code Formatter + nix # Powerful package manager, makes packaging reliable & reproducible + tea # Gitea official CLI client + treefmt # one CLI to format the code tree + ]; + }