-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c19287
commit c75040b
Showing
6 changed files
with
188 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: "Template test: darwin-system" | ||
on: | ||
push: | ||
paths: | ||
- .github/workflows/template-darwin-system.yaml | ||
- templates/darwin-system/* | ||
|
||
jobs: | ||
binary-cache: | ||
permissions: | ||
contents: write | ||
runs-on: macos-latest | ||
steps: | ||
- uses: "actions/checkout@v4" | ||
- uses: "DeterminateSystems/nix-installer-action@main" | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
name: luke-channings | ||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
- name: Build packages | ||
run: | | ||
export NIXPKGS_ALLOW_UNFREE=1 | ||
nix flake new -t .#darwin-system darwin-system | ||
nix run --flake ./darwin-system#activate |
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,6 @@ | ||
.DS_Store | ||
.devenv | ||
.direnv | ||
.vscode | ||
.env | ||
result |
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 @@ | ||
{ inputs, ... }: | ||
let | ||
inherit (builtins) attrValues; | ||
inherit (inputs) dotfiles nix-darwin; | ||
in | ||
{ | ||
flake.darwinConfigurations.default = nix-darwin.lib.darwinSystem { | ||
system = "aarch64-darwin"; | ||
|
||
inherit inputs; | ||
|
||
modules = [ | ||
(dotfiles.lib.configureOsModules { | ||
osModules = attrValues dotfiles.modules.darwin; | ||
homeModules = attrValues dotfiles.modules.homeModules; | ||
}) | ||
( | ||
let | ||
username = "luke"; | ||
in | ||
{ ... }: | ||
{ | ||
users = { | ||
knownUsers = [ username ]; | ||
|
||
users.${username} = { | ||
home = "/Users/${username}"; | ||
uid = 502; | ||
}; | ||
}; | ||
} | ||
) | ||
]; | ||
}; | ||
} |
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,64 @@ | ||
{ inputs, ... }: | ||
{ | ||
imports = [ | ||
inputs.devenv.flakeModule | ||
inputs.treefmt-nix.flakeModule | ||
]; | ||
|
||
perSystem = | ||
{ | ||
config, | ||
pkgs, | ||
lib, | ||
system, | ||
... | ||
}: | ||
{ | ||
treefmt = { | ||
projectRoot = ./.; | ||
projectRootFile = "flake.nix"; | ||
|
||
programs.nixfmt.enable = true; | ||
programs.deadnix.enable = true; | ||
programs.biome = { | ||
enable = true; | ||
settings.formatter.indentStyle = "space"; | ||
}; | ||
}; | ||
|
||
devenv.shells.default = { | ||
devenv.root = | ||
let | ||
devenvRootFileContent = builtins.readFile inputs.devenv-root.outPath; | ||
in | ||
pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent; | ||
|
||
imports = [ inputs.toolbox.modules.devenv.vscode-workspace ]; | ||
|
||
packages = with pkgs; [ | ||
nixVersions.latest | ||
]; | ||
|
||
vscode-workspace = { | ||
extensions = with inputs.vscode-extensions.extensions.${system}.vscode-marketplace; [ | ||
jnoortheen.nix-ide | ||
ibecker.treefmt-vscode | ||
]; | ||
|
||
settings = { | ||
nix = { | ||
enableLanguageServer = true; | ||
serverPath = lib.getExe pkgs.nil; | ||
}; | ||
|
||
treefmt = { | ||
command = lib.getExe config.treefmt.package; | ||
config = config.treefmt.build.configFile; | ||
}; | ||
|
||
editor.defaultFormatter = "ibecker.treefmt-vscode"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
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,54 @@ | ||
{ | ||
description = "Configuration for Luke's CAIS MacBook Pro"; | ||
|
||
inputs = { | ||
devenv-root = { | ||
url = "file+file:///dev/null"; | ||
flake = false; | ||
}; | ||
dotfiles.url = "github:lukechannings/dotfiles"; | ||
dotfiles.inputs.devenv-root.follows = "devenv-root"; | ||
}; | ||
|
||
outputs = | ||
inputs@{ dotfiles, self, ... }: | ||
let | ||
inputs' = dotfiles.inputs // inputs; | ||
in | ||
inputs'.flake-parts.lib.mkFlake { inputs = inputs'; } { | ||
imports = [ | ||
./devenv.nix | ||
./configuration.nix | ||
]; | ||
|
||
systems = [ | ||
"aarch64-darwin" | ||
"x86_64-darwin" | ||
|
||
"x86_64-linux" | ||
"aarch64-linux" | ||
]; | ||
|
||
perSystem = | ||
{ system, ... }: | ||
let | ||
pkgs = inputs'.nixpkgs.legacyPackages.${system}; | ||
in | ||
{ | ||
_module.args.pkgs = pkgs; | ||
|
||
packages = | ||
let | ||
inherit (inputs.dotfiles.inputs.nix-darwin.packages.${system}) darwin-rebuild; | ||
in | ||
{ | ||
inherit darwin-rebuild; | ||
|
||
activate = pkgs.writeScriptBin "activate" '' | ||
#!${pkgs.bash}/bin/bash | ||
${darwin-rebuild}/bin/darwin-rebuild switch --flake ${self}#default | ||
''; | ||
}; | ||
}; | ||
}; | ||
} |
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