From 72591b23c49ee8313e3fcf10bca19cf300caf47d Mon Sep 17 00:00:00 2001 From: stubbfel Date: Sat, 10 Jun 2023 15:48:42 +0000 Subject: [PATCH] test --- flake.lock | 52 ++++++++++++++++++++++++++-- flake.nix | 9 ++--- playground/example/config/flake.nix | 4 +-- playground/example/service/flake.nix | 45 ++++-------------------- src/hello.sh | 3 -- 5 files changed, 61 insertions(+), 52 deletions(-) delete mode 100755 src/hello.sh diff --git a/flake.lock b/flake.lock index d2ab926..b00729f 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,26 @@ "locked": { "lastModified": 1, "narHash": "sha256-x1tXOK1tiPQabKK5TOzHQ0HxtFobkEoxwWPvuo6YYvc=", - "path": "/nix/store/1cvr44p1k6r0qq7fydsp7x3yhpwgm0v9-source/config", + "path": "config", "type": "path" }, "original": { - "path": "/nix/store/1cvr44p1k6r0qq7fydsp7x3yhpwgm0v9-source/config", + "path": "config", + "type": "path" + } + }, + "config_2": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-x1tXOK1tiPQabKK5TOzHQ0HxtFobkEoxwWPvuo6YYvc=", + "path": "config", + "type": "path" + }, + "original": { + "path": "config", "type": "path" } }, @@ -30,9 +45,40 @@ "type": "indirect" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1686331006, + "narHash": "sha256-hElRDWUNG655aqF0awu+h5cmDN+I/dQcChRt2tGuGGU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "85bcb95aa83be667e562e781e9d186c57a07d757", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-23.05", + "type": "indirect" + } + }, + "playground": { + "inputs": { + "config": "config_2" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-6/SzH0gS563+ouSexLKi3gmTlyOsgg3Ps/plwn8IhnE=", + "path": "playground/example/service", + "type": "path" + }, + "original": { + "path": "playground/example/service", + "type": "path" + } + }, "root": { "inputs": { - "config": "config" + "config": "config", + "playground": "playground" } } }, diff --git a/flake.nix b/flake.nix index bc8ddd4..b07d11f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,8 @@ { description = ""; inputs = { - config.url = "./config"; - playground.url = "./playground/example/service"; + config.url = "path:config"; + playground.url = "path:playground/example/service"; }; outputs = { self, config, playground }: let @@ -28,10 +28,7 @@ nix --experimental-features 'nix-command flakes' build ''; in { - default = { - type = "app"; - program = "${packages.${system}.default}/bin/hello.sh"; - }; + default = playground.apps.default; devTasks = { updateFlakeLock = { type = "app"; diff --git a/playground/example/config/flake.nix b/playground/example/config/flake.nix index 7e5ef79..e3b5ae4 100644 --- a/playground/example/config/flake.nix +++ b/playground/example/config/flake.nix @@ -1,5 +1,5 @@ { - inputs = { config.url = "./config"; }; + inputs = { config.url = "path:config"; }; - outputs = { self, config }: config; + outputs = { self, config }: config //. {playground = { port = "8080"; }; }; } diff --git a/playground/example/service/flake.nix b/playground/example/service/flake.nix index afd9b10..1919ca6 100644 --- a/playground/example/service/flake.nix +++ b/playground/example/service/flake.nix @@ -1,6 +1,6 @@ { description = ""; - inputs = { config.url = "./config"; }; + inputs = { config.url = "path:playground/example/config"; }; outputs = { self, config }: let version = "0.0.1"; @@ -16,47 +16,16 @@ }); in rec { packages = forAllSystems (system: { - default = nixpkgsFor.${system}.stdenv.mkDerivation { - name = name; - src = self; - buildPhase = "echo nothing todo"; - installPhase = "mkdir -p $out/bin; install -t $out/bin src/hello.sh"; - }; + default = nixpkgsFor.${system}.writeScript "python-webserver" '' + python -m http.server 8080 + ''; }); - apps = forAllSystems (system: - let - updateLockScript = - nixpkgsFor.${system}.writeShellScriptBin "update_flake_lock.sh" '' - nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs - nix --experimental-features 'nix-command flakes' build - ''; - in { + apps = forAllSystems (system: { default = { type = "app"; - program = "${packages.${system}.default}/bin/hello.sh"; + program = "${packages.${system}.default}"; }; - devTasks = { - updateFlakeLock = { - type = "app"; - program = "${updateLockScript}/bin/update_flake_lock.sh"; - }; - autoTag = { - type = "app"; - program = "${devTaskScripts.${system}.autoTag}"; - }; - }; - }); - - devShells = forAllSystems (system: { - default = nixpkgsFor.${system}.mkShell { - name = "dev-shell"; - packages = [ nixpkgsFor.${system}.nixfmt ]; - shellHook = '' - . ./alias.sh - ''; - }; - }); - + }); }; } diff --git a/src/hello.sh b/src/hello.sh deleted file mode 100755 index 2202fe7..0000000 --- a/src/hello.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/env bash - -echo "hello world" \ No newline at end of file