From e1f65562576f9f36afb269de062895acdc939909 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 20:13:01 +0200 Subject: [PATCH 01/11] Add nix flake for dev shell To try it you need **nix** installed `nix-daemon ` running and your user has to be member of the **nix-users** group. Or use NixOS. then by just: ```sh nix develop -c $SHELL ``` a dedicated development environment with all needed packages will be created. --- flake.lock | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 39 ++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000000..68db382255c4d --- /dev/null +++ b/flake.lock @@ -0,0 +1,76 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1715623576, + "narHash": "sha256-ofUOGRGQk6GpQ+HKGXRb0DSzy9BqveubutyJFWQRAJI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1daef0114a6074be56586f2cf81898ed142e1e44", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000000..a0ecae499e393 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + # Override nixpkgs to use the latest set of node packages + inputs.nixpkgs.url = "github:NixOS/nixpkgs/master"; + inputs.systems.url = "github:nix-systems/default"; + + outputs = + { + self, + nixpkgs, + flake-utils, + systems, + }: + flake-utils.lib.eachSystem (import systems) ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + # generic + git + git-lfs + gnumake + gnutar + + # frontend + nodejs + nodePackages.npm + + # backend + go + gofumpt + golangci-lint + ]; + }; + } + ); +} From f1977e5e940d3e1f4334c46f9735285fcba679c2 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 21:06:55 +0200 Subject: [PATCH 02/11] pin versions based on docs --- flake.lock | 30 +++++++----------------------- flake.nix | 15 +++++++-------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index 68db382255c4d..358596d01bb9e 100644 --- a/flake.lock +++ b/flake.lock @@ -19,16 +19,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715623576, - "narHash": "sha256-ofUOGRGQk6GpQ+HKGXRb0DSzy9BqveubutyJFWQRAJI=", - "owner": "NixOS", + "lastModified": 1715542476, + "narHash": "sha256-FF593AtlzQqa8JpzrXyRws4CeKbc5W86o8tHt4nRfIg=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "1daef0114a6074be56586f2cf81898ed142e1e44", + "rev": "44072e24566c5bcc0b7aa9178a0104f4cfffab19", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "master", + "owner": "nixos", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } @@ -36,8 +36,7 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "systems": "systems_2" + "nixpkgs": "nixpkgs" } }, "systems": { @@ -54,21 +53,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index a0ecae499e393..abae409f68455 100644 --- a/flake.nix +++ b/flake.nix @@ -1,16 +1,15 @@ { - # Override nixpkgs to use the latest set of node packages - inputs.nixpkgs.url = "github:NixOS/nixpkgs/master"; - inputs.systems.url = "github:nix-systems/default"; - + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; + }; outputs = { self, nixpkgs, flake-utils, - systems, + ... }: - flake-utils.lib.eachSystem (import systems) ( + flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { inherit system; }; @@ -25,11 +24,11 @@ gnutar # frontend - nodejs + nodejs_20 nodePackages.npm # backend - go + go_1_20 gofumpt golangci-lint ]; From 4b6870e6f19cc34438a6938292b017ce40c89a2f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 21:26:18 +0200 Subject: [PATCH 03/11] Apply suggestions from code review Co-authored-by: John Olheiser --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index abae409f68455..6427fe27d07ea 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ flake-utils.lib.eachDefaultSystem ( system: let - pkgs = import nixpkgs { inherit system; }; + pkgs = nixpkgs.legacyPackages.${system}; in { devShells.default = pkgs.mkShell { @@ -25,7 +25,6 @@ # frontend nodejs_20 - nodePackages.npm # backend go_1_20 From 06a1de884cda74762d753d3e9021c15d32bee529 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 21:28:12 +0200 Subject: [PATCH 04/11] "github:numtide/flake-utils"; --- flake.lock | 5 +++-- flake.nix | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index 358596d01bb9e..57095deac8963 100644 --- a/flake.lock +++ b/flake.lock @@ -13,8 +13,9 @@ "type": "github" }, "original": { - "id": "flake-utils", - "type": "indirect" + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } }, "nixpkgs": { diff --git a/flake.nix b/flake.nix index 6427fe27d07ea..cb57f8ee12dd9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; + flake-utils.url = "github:numtide/flake-utils"; }; outputs = { From b38423662d8d20f4158044efb7c2ff74c230acf5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 21:42:35 +0200 Subject: [PATCH 05/11] use unstable --- flake.lock | 8 ++++---- flake.nix | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 57095deac8963..0b2278f080265 100644 --- a/flake.lock +++ b/flake.lock @@ -20,16 +20,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715542476, - "narHash": "sha256-FF593AtlzQqa8JpzrXyRws4CeKbc5W86o8tHt4nRfIg=", + "lastModified": 1715534503, + "narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "44072e24566c5bcc0b7aa9178a0104f4cfffab19", + "rev": "2057814051972fa1453ddfb0d98badbea9b83c06", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index cb57f8ee12dd9..d567a4db26e26 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = @@ -28,7 +28,7 @@ nodejs_20 # backend - go_1_20 + go_1_22 gofumpt golangci-lint ]; From 70c9bd09ebc3d18ad181135696bf7c4d0196bbbf Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 21:52:36 +0200 Subject: [PATCH 06/11] Update flake.nix Co-authored-by: John Olheiser --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index d567a4db26e26..e72b5bc093224 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,6 @@ }; outputs = { - self, nixpkgs, flake-utils, ... From 7c9f18d4934fa08174ed029675b1184b337299d8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 13 May 2024 21:54:11 +0200 Subject: [PATCH 07/11] fmt --- flake.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index e72b5bc093224..21ae240c2fe7e 100644 --- a/flake.nix +++ b/flake.nix @@ -4,11 +4,7 @@ flake-utils.url = "github:numtide/flake-utils"; }; outputs = - { - nixpkgs, - flake-utils, - ... - }: + { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem ( system: let From dbd04db74c491fac7ac66daa5828974accffc21d Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 14 May 2024 04:52:54 +0200 Subject: [PATCH 08/11] Update flake.nix --- flake.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/flake.nix b/flake.nix index 21ae240c2fe7e..f0b713af61ae9 100644 --- a/flake.nix +++ b/flake.nix @@ -24,8 +24,6 @@ # backend go_1_22 - gofumpt - golangci-lint ]; }; } From 3f64931f811288c0f86dd012ebbdb4f92a7dc706 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 15 May 2024 21:38:16 +0200 Subject: [PATCH 09/11] pin more tools via flake --- flake.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flake.nix b/flake.nix index f0b713af61ae9..61a7edc03da3b 100644 --- a/flake.nix +++ b/flake.nix @@ -17,11 +17,17 @@ git git-lfs gnumake + gnused gnutar + gzip # frontend nodejs_20 + # templates + poetry + poetry + # backend go_1_22 ]; From d31877ec2c3a409cd1de9b0d670360f7b93c0ba2 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 17 May 2024 00:27:34 +0200 Subject: [PATCH 10/11] Update flake.nix Co-authored-by: John Olheiser --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 61a7edc03da3b..7b182e1bc27ce 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ nodejs_20 # templates - poetry + python312 poetry # backend From 6ca581558b5a604e694633d6a632ad7075102a9d Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 17 May 2024 00:28:38 +0200 Subject: [PATCH 11/11] Update flake.nix --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 7b182e1bc27ce..c6e915e9db4f7 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ # frontend nodejs_20 - # templates + # linting python312 poetry