From b25ab16bd71c18556cd7d24d003bdabab497f42b Mon Sep 17 00:00:00 2001 From: Sparky Date: Wed, 29 Oct 2025 12:52:59 +0100 Subject: [PATCH] Hallucinate some kinda flake business --- configuration.nix | 7 +++++-- flake.nix | 18 ++++++++++++++++++ sync-sparky.yml | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 flake.nix diff --git a/configuration.nix b/configuration.nix index 53616e7..6f5d3ba 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,11 +2,11 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running 'nixos-help'). -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: with lib; let - unstable = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz") { config = { allowUnfree = true; }; }; + unstable = import inputs.nixpkgs-unstable { inherit (config.nixpkgs) config; }; in { @@ -257,4 +257,7 @@ in # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "25.05"; # Did you read the comment? + + # Enable flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; } diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..eea6133 --- /dev/null +++ b/flake.nix @@ -0,0 +1,18 @@ +{ + description = "NixOS configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs: { + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./configuration.nix + ]; + }; + }; +} diff --git a/sync-sparky.yml b/sync-sparky.yml index 4ea2ac3..7bc7e4b 100755 --- a/sync-sparky.yml +++ b/sync-sparky.yml @@ -15,6 +15,9 @@ - source: configuration.nix target: /etc/nixos/configuration.nix delete: true +- source: flake.nix + target: /etc/nixos/flake.nix + delete: true - source: sparky.gitconfig target: /home/dave/.gitconfig