diff options
| author | Domen Kožar <domen@dev.si> | 2023-06-18 18:45:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-18 18:45:30 +0100 |
| commit | 1759eb2699f4d10bf655486e71fea6dbb3138d3d (patch) | |
| tree | 997e039acd0dbd92e78d1c313cf7d6ae9aa9205e /modules | |
| parent | 7c16d31383a90e0e72ace0c35d2d66a18f90fb4f (diff) | |
| parent | 8d13a55f1c3020825400ef066ab13ef62ca441bf (diff) | |
Merge pull request #688 from Enzime/add/template
flake: add template with basic flake config
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/examples/flake.nix | 31 | ||||
| -rw-r--r-- | modules/examples/flake/flake.nix | 46 |
2 files changed, 46 insertions, 31 deletions
diff --git a/modules/examples/flake.nix b/modules/examples/flake.nix deleted file mode 100644 index 2c5f90e..0000000 --- a/modules/examples/flake.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - description = "Example darwin system flake"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs"; - darwin.url = "github:lnl7/nix-darwin"; - darwin.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = { self, darwin, nixpkgs }: - let - configuration = { pkgs, ... }: { - nix.package = pkgs.nixVersions.stable; - - # FIXME: for github actions, this shouldn't be in the example. - services.nix-daemon.enable = true; - }; - in - { - # Build darwin flake using: - # $ darwin-rebuild build --flake ./modules/examples#simple \ - # --override-input darwin . - darwinConfigurations."simple" = darwin.lib.darwinSystem { - modules = [ configuration darwin.darwinModules.simple ]; - system = "x86_64-darwin"; - }; - - # Expose the package set, including overlays, for convenience. - darwinPackages = self.darwinConfigurations."simple".pkgs; - }; -} diff --git a/modules/examples/flake/flake.nix b/modules/examples/flake/flake.nix new file mode 100644 index 0000000..0ada852 --- /dev/null +++ b/modules/examples/flake/flake.nix @@ -0,0 +1,46 @@ +{ + description = "Example darwin system flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + darwin.url = "github:lnl7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, darwin, nixpkgs }: + let + configuration = { pkgs, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = + [ pkgs.vim + ]; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + # programs.fish.enable = true; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#simple + darwinConfigurations."simple" = darwin.lib.darwinSystem { + modules = [ configuration ]; + system = "x86_64-darwin"; + }; + + # Expose the package set, including overlays, for convenience. + darwinPackages = self.darwinConfigurations."simple".pkgs; + }; +} |
