Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Based on [Misterio's starter config
example](https://github.com/Misterio77/nix-starter-configs).
  • Loading branch information
MattSturgeon committed Jun 6, 2023
0 parents commit e8f92db
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/result
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# My nix configuration

This is a nix flake defining my system and user configurations. It is currently work in progress and very incomplete.

## Initial bootstrap

If the experimental feature `nix-command` and `flakes` not enabled, run `nix-shell` from this directory to enable them.

Run `nixos-rebuild --flake .#matts-laptop` to install the system configuration.

Run `home-manager --flake .#matt@matts-laptop` to install the user configuration.

## Updating

TODO
49 changes: 49 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
description = "My nix config";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
in
rec {
# Devshell for bootstrapping
# Acessible through `nix develop` or `nix-shell` (legacy)
devShells = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./shell.nix { inherit pkgs; }
);

# TODO Add any overlays/modules here?

# NixOS configuration entrypoint
# Available through `nixos-rebuild --flake .#matts-laptop`
nixosConfigurations = {
matts-laptop = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# Main nixos configuration file
./nixos/configuration.nix
];
};
};

# Standalone home-manager configuration entrypoint
# Available through `home-manager --flake .#matt@matts-laptop`
homeConfigurations = {
"matt@matts-laptop" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = { inherit inputs outputs; };
modules = [
# Main home-manager configuration file
./home-manager/home.nix
];
};
};
};
}
10 changes: 10 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Shell for bootstrapping flake-enabled nix and home-manager
# You can enter it through 'nix develop' or (legacy) 'nix-shell'

{ pkgs ? (import ./nixpkgs.nix) { } }: {
default = pkgs.mkShell {
# Enable experimental features without having to specify the argument
NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [ nix home-manager git ];
};
}

0 comments on commit e8f92db

Please sign in to comment.