From 89ea349312911e8034e58a3a016faa8ce66ce366 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 19 Oct 2023 09:47:49 +0200 Subject: [PATCH 1/2] examples/flake.nix: add comments and extra service Like in importable-configuration.nix --- examples/flakes/flake.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/flakes/flake.nix b/examples/flakes/flake.nix index 31216d3..1037a96 100644 --- a/examples/flakes/flake.nix +++ b/examples/flakes/flake.nix @@ -1,3 +1,10 @@ +# This is a system configuration template that uses nix-bitcoin. +# +# You can adapt this to an existing system flake by copying the parts +# relevant to nix-bitcoin. +# +# Make sure to check and edit all lines marked by 'FIXME:' + { description = "A basic nix-bitcoin node"; @@ -23,21 +30,25 @@ # The secrets are stored in /etc/nix-bitcoin-secrets nix-bitcoin.generateSecrets = true; - # Enable services. + # Enable some services. # See ../configuration.nix for all available features. services.bitcoind.enable = true; + services.clightning.enable = true; # When using nix-bitcoin as part of a larger NixOS configuration, set the following to enable # interactive access to nix-bitcoin features (like bitcoin-cli) for your system's main user nix-bitcoin.operator = { enable = true; - name = "main"; # Set this to your system's main user + # FIXME: Set this to your system's main user + name = "main"; }; - # The system's main unprivileged user. This setting is usually part of your - # existing NixOS configuration. + # The system's main unprivileged user. + # In an existing NixOS configuration, this setting is usually already defined. users.users.main = { isNormalUser = true; + # FIXME: This is unsafe. Use `hashedpassword` or `passwordFile` instead in a real + # deployment: https://search.nixos.org/options?show=users.users.%3Cname%3E.hashedPassword password = "a"; }; From 742fd8fdd0a66d705def05e2e85522ed1561a813 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 19 Oct 2023 09:48:46 +0200 Subject: [PATCH 2/2] examples/flake.nix: add `inputs.nixpkgs` To make this template look more like a regular system flake. --- dev/README.md | 1 + examples/flakes/flake.nix | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dev/README.md b/dev/README.md index 9b93a5c..0e37eb3 100644 --- a/dev/README.md +++ b/dev/README.md @@ -101,4 +101,5 @@ It's easiest to use an existing service as a template: - [flake.nix](../flake.nix): update `nixpkgs.url` - [cirrus.yml](../.cirrus.yml): update toplevel container -> image attribute - [examples/configuration.nix](../examples/configuration.nix): update `system.stateVersion` +- [examples/flakes/flake.nix](../examples/flakes/flake.nix): update `inputs.nix-bitcoin.url` - Treewide: check if any `TODO-EXTERNAL` comments can be resolved diff --git a/examples/flakes/flake.nix b/examples/flakes/flake.nix index 1037a96..355c400 100644 --- a/examples/flakes/flake.nix +++ b/examples/flakes/flake.nix @@ -12,9 +12,12 @@ # You can also use a version branch to track a specific NixOS release # inputs.nix-bitcoin.url = "github:fort-nix/nix-bitcoin/nixos-23.05"; - outputs = { self, nix-bitcoin }: { + inputs.nixpkgs.follows = "nix-bitcoin/nixpkgs"; + inputs.nixpkgs-unstable.follows = "nix-bitcoin/nixpkgs-unstable"; - nixosConfigurations.mynode = nix-bitcoin.inputs.nixpkgs.lib.nixosSystem { + outputs = { self, nixpkgs, nix-bitcoin, ... }: { + + nixosConfigurations.mynode = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ nix-bitcoin.nixosModules.default