-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convention-over-configuration layout (#62)
- Loading branch information
Showing
141 changed files
with
359 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
use flake | ||
watch_file \ | ||
flake-parts/devshell.nix \ | ||
flake-module.nix | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
result | ||
.direnv | ||
*.qcow2 | ||
/result | ||
/.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Configuration for this repo | ||
# See ./modules/flake-parts/config.nix for module options. | ||
{ | ||
me = { | ||
username = "srid"; | ||
fullname = "Sridhar Ratnakumar"; | ||
email = "[email protected]"; | ||
# Legacy | ||
# "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCYQ003p7fB5ICQehLwhDBomY9WzkNBeijkSw9ADGU+ECrPakeIH3pntUWRJH1W93vKnLqpkn6HLGEXD9MCR0s98uhh8hT7uAYCxQTbEeKT3PYkfz3oe7XaR8rE601sds0ZyFwH7l8cvK97pGr+uhFXAaohiV6VqmLVXhManEjZZ8GfYWBD9BCmIJk43G3OGa5QYFeHqztprXaJNU5dFPv2Uq2C+L6EvfCfkK2OO1BLZgL+Rai5jjyy6k0fcfsxxd9BdGUwqDhcBeyTIzX9rePMugf/xD+6uNRxTU+vjVpGUtFOw6rpgmVyFv9mn3QMNdQBc5hYKVbIQwMNGTzGgcQv srid@nixos" | ||
sshKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHQRxPoqlThDrkR58pKnJgmeWPY9/wleReRbZ2MOZRyd"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# My Ubuntu VM | ||
{ flake, ... }: | ||
let | ||
inherit (flake.inputs) self; | ||
in | ||
{ | ||
imports = [ | ||
self.homeModules.default | ||
self.homeModules.linux-only | ||
]; | ||
home.username = "srid"; | ||
home.homeDirectory = "/home/srid"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# An opinionated module that creates flake outputs based on a known directory structure. | ||
# | ||
# cf. Convention over configuration | ||
# | ||
# TODO: Upstream this in some fashion. To srid/nixos-flake? | ||
# cf. https://github.com/juspay/nix-dev-home/issues/86 | ||
{ inputs, self, ... }: | ||
let | ||
inherit (inputs.nixpkgs) lib; | ||
forAllNixFiles = dir: f: | ||
lib.pipe dir [ | ||
builtins.readDir | ||
(lib.filterAttrs (_: type: type == "regular")) | ||
(lib.mapAttrs' (fn: _: | ||
let name = lib.removeSuffix ".nix" fn; in | ||
lib.nameValuePair name (f "${dir}/${fn}") | ||
)) | ||
]; | ||
in | ||
{ | ||
flake = { | ||
darwinConfigurations = | ||
forAllNixFiles "${self}/configurations/darwin" | ||
(fn: self.nixos-flake.lib.mkMacosSystem { home-manager = true; } fn); | ||
|
||
nixosConfigurations = | ||
forAllNixFiles "${self}/configurations/nixos" | ||
(fn: self.nixos-flake.lib.mkLinuxSystem { home-manager = true; } fn); | ||
|
||
darwinModules = | ||
forAllNixFiles "${self}/modules/darwin" | ||
(fn: fn); | ||
|
||
nixosModules = | ||
forAllNixFiles "${self}/modules/nixos" | ||
(fn: fn); | ||
|
||
homeModules = | ||
forAllNixFiles "${self}/modules/home" | ||
(fn: fn); | ||
|
||
overlays = | ||
forAllNixFiles "${self}/overlays" | ||
(fn: import fn self.nixos-flake.lib.specialArgsFor.common); | ||
}; | ||
|
||
perSystem = { pkgs, ... }: { | ||
legacyPackages.homeConfigurations = | ||
forAllNixFiles "${self}/configurations/home" | ||
(fn: self.nixos-flake.lib.mkHomeConfiguration pkgs fn); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Configuration common to all macOS systems | ||
{ flake, ... }: | ||
let | ||
inherit (flake) config inputs; | ||
inherit (inputs) self; | ||
in | ||
{ | ||
imports = [ | ||
{ | ||
home-manager.users.${config.me.username} = { }; | ||
home-manager.sharedModules = [ | ||
self.homeModules.default | ||
self.homeModules.darwin-only | ||
]; | ||
} | ||
self.nixosModules.common | ||
inputs.ragenix.darwinModules.default | ||
./all/zsh-completion-fix.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Top-level configuration for everything in this repo. | ||
# | ||
# Values are set in 'config.nix' in repo root. | ||
{ lib, ... }: | ||
let | ||
userSubmodule = lib.types.submodule { | ||
options = { | ||
username = lib.mkOption { | ||
type = lib.types.str; | ||
}; | ||
fullname = lib.mkOption { | ||
type = lib.types.str; | ||
}; | ||
email = lib.mkOption { | ||
type = lib.types.str; | ||
}; | ||
sshKey = lib.mkOption { | ||
type = lib.types.str; | ||
description = '' | ||
SSH public key | ||
''; | ||
}; | ||
}; | ||
}; | ||
in | ||
{ | ||
imports = [ | ||
../../config.nix | ||
]; | ||
options = { | ||
me = lib.mkOption { | ||
type = userSubmodule; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.