From e0f4f44624ea9344d5685b2cd57dd5030763ad5b Mon Sep 17 00:00:00 2001 From: eveeifyeve <88671402+Eveeifyeve@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:04:12 +1100 Subject: [PATCH 1/2] Nix init --- .envrc | 1 + .github/workflows/update-nix.yml | 18 ++++++++++ .gitignore | 5 ++- flake.lock | 58 ++++++++++++++++++++++++++++++++ flake.nix | 26 ++++++++++++++ 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 .github/workflows/update-nix.yml create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/update-nix.yml b/.github/workflows/update-nix.yml new file mode 100644 index 00000000..38c3e5ed --- /dev/null +++ b/.github/workflows/update-nix.yml @@ -0,0 +1,18 @@ +name: update-flake-lock +on: + workflow_dispatch: # allows manual triggering + schedule: + - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 + +jobs: + lockfile: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Update flake.lock + uses: DeterminateSystems/update-flake-lock@main + with: + pr-title: "Update flake.lock" diff --git a/.gitignore b/.gitignore index 2fbfefd7..784bfa73 100644 --- a/.gitignore +++ b/.gitignore @@ -366,4 +366,7 @@ FodyWeavers.xsd *.bat # JetBrains Rider -.idea/ \ No newline at end of file +.idea/ + +# nix +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..949cd41f --- /dev/null +++ b/flake.lock @@ -0,0 +1,58 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1729880355, + "narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18536bf04cd71abd345f9579158841376fdd0c5a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1727825735, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..cae40610 --- /dev/null +++ b/flake.nix @@ -0,0 +1,26 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = inputs@{ nixpkgs, flake-parts, ... }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = nixpkgs.lib.systems.flakeExposed; + perSystem = { + lib, + pkgs, + system, + config, + ... + }: + { + devShells.default = pkgs.mkShell + { + packages = with pkgs; [ + dotnet-sdk_8 + ]; + }; + }; + }; +} From 83f7e697c09c553678c132889b0272f76e4bd614 Mon Sep 17 00:00:00 2001 From: eveeifyeve <88671402+Eveeifyeve@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:12:38 +1100 Subject: [PATCH 2/2] Added nix formatter --- flake.nix | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index cae40610..63c53361 100644 --- a/flake.nix +++ b/flake.nix @@ -4,23 +4,25 @@ flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = inputs@{ nixpkgs, flake-parts, ... }: - flake-parts.lib.mkFlake {inherit inputs;} { + outputs = + inputs@{ nixpkgs, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { systems = nixpkgs.lib.systems.flakeExposed; - perSystem = { - lib, - pkgs, - system, - config, - ... - }: - { - devShells.default = pkgs.mkShell + perSystem = { - packages = with pkgs; [ - dotnet-sdk_8 - ]; + lib, + pkgs, + system, + config, + ... + }: + { + formatter = pkgs.nixfmt-rfc-style; + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + dotnet-sdk_8 + ]; + }; }; - }; }; }