mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-13 19:27:53 -06:00
Compare commits
7 commits
77045fc4d2
...
128ddc47a9
Author | SHA1 | Date | |
---|---|---|---|
128ddc47a9 | |||
a2d7340ae8 | |||
35c93707de | |||
c84ef6a384 | |||
d1cd4900b4 | |||
5004ce8353 | |||
a4d27c83c1 |
10 changed files with 132 additions and 83 deletions
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
|
@ -20,7 +20,6 @@ on:
|
|||
default: 'othalan aligz'
|
||||
type: string
|
||||
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }}
|
||||
cancel-in-progress: true
|
||||
|
@ -34,7 +33,10 @@ jobs:
|
|||
|
||||
- uses: ./.github/actions/clean-disk
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/nix-installer-action@v12
|
||||
with:
|
||||
extra-conf: |
|
||||
accept-flake-config = true
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@v7
|
||||
|
||||
- uses: cachix/cachix-action@v15
|
||||
|
@ -51,5 +53,6 @@ jobs:
|
|||
- name: Build
|
||||
run: |
|
||||
for host in ${{ inputs.host }}; do
|
||||
nix run . --accept-flake-config -- cache --host "$host" --flake .
|
||||
cachix watch-exec daylin -- nix build --print-build-logs "$(nix run . -- output --system-path --host "$host" --flake .)^*"
|
||||
# nix run . --accept-flake-config -- cache --host "$host" --flake .
|
||||
done
|
||||
|
|
12
.github/workflows/checks.yml
vendored
12
.github/workflows/checks.yml
vendored
|
@ -8,12 +8,8 @@ on:
|
|||
description: 'flake.lock file'
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -23,6 +19,9 @@ jobs:
|
|||
purge-packages: false
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
with:
|
||||
extra-conf: |
|
||||
accept-flake-config = true
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@v7
|
||||
|
||||
- uses: cachix/cachix-action@v15
|
||||
|
@ -38,4 +37,5 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
cachix watch-exec daylin -- nix build --accept-flake-config '.#checks.x86_64-linux.makePackages'
|
||||
set -euo pipefail
|
||||
cachix watch-exec daylin -- nix build '.#checks.x86_64-linux.makePackages'
|
||||
|
|
12
.github/workflows/push.yml
vendored
12
.github/workflows/push.yml
vendored
|
@ -8,13 +8,17 @@ on:
|
|||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
uses: ./.github/workflows/checks.yml
|
||||
secrets: inherit
|
||||
# checks:
|
||||
# uses: ./.github/workflows/checks.yml
|
||||
# secrets: inherit
|
||||
|
||||
build:
|
||||
needs: checks
|
||||
# needs: checks
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
|
|
62
flake.lock
62
flake.lock
|
@ -5,11 +5,11 @@
|
|||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1716316901,
|
||||
"narHash": "sha256-AWzUBSlgPVszYMk611mHgoHCA/hXjzos50KvKJfHCs8=",
|
||||
"lastModified": 1718728970,
|
||||
"narHash": "sha256-R8FjmfsIrTUXMPtmjCNKeTR6cBMCY75WMnH5PfGXHFQ=",
|
||||
"owner": "daylinmorgan",
|
||||
"repo": "f1multiviewer-flake",
|
||||
"rev": "89653c7aa046dd23fd61b2ddae6c55725857b224",
|
||||
"rev": "a04a548c5e88933a2aed21544d18812860f14212",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -305,11 +305,11 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718633685,
|
||||
"narHash": "sha256-dAuZ6mIIVQraN1PnCe12Qwdcs/Nvfe/zfSy45ED5aso=",
|
||||
"lastModified": 1718723174,
|
||||
"narHash": "sha256-cPIOblG2H8Z934FPeuU0I6kI1Ke8ZbF330Nq/hTJ2uU=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "a9c7a0830fd9a8b9fc4065f1cd654efd1326691a",
|
||||
"revCount": 4856,
|
||||
"rev": "236150b3c5227bbfbe46d2610c739a386afdca1f",
|
||||
"revCount": 4859,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/hyprwm/Hyprland/"
|
||||
|
@ -630,11 +630,11 @@
|
|||
"nixpkgs": "nixpkgs_5"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718470009,
|
||||
"narHash": "sha256-VBeDG3we0bkbFWMyZy+wjUkmeDN58pGFzw1dQCTeDV8=",
|
||||
"lastModified": 1718710563,
|
||||
"narHash": "sha256-O4rrM0Bkh3IRe8D600iniQ52QTmlnuTSp2KyXV7C2jE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "e0a970cbb8c3af05c80ef48a336ad91efd9b2bf6",
|
||||
"rev": "2fb93bea657ad99a7005ef601c67cb2820560a41",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -645,11 +645,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1712163089,
|
||||
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
|
||||
"lastModified": 1718530797,
|
||||
"narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||
"rev": "b60ebf54c15553b393d144357375ea956f89e9a9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -682,11 +682,11 @@
|
|||
"nixpkgs": "nixpkgs_8"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718630464,
|
||||
"narHash": "sha256-GXuN6MmzNomxT9VOEFu4iwP1kRTJ7F3/HdOzeDGPE1c=",
|
||||
"lastModified": 1718727726,
|
||||
"narHash": "sha256-WIoMGbYpJMc9TTPeJeoGXRw5KaUkqDVMmtQp412ThOk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs-wayland",
|
||||
"rev": "4a3b27cc9526208686896d0ef01c7bb67a47b91f",
|
||||
"rev": "7a80040b517fdfcf8a97749b58afc47bbea4b8c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -745,11 +745,11 @@
|
|||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1717696253,
|
||||
"narHash": "sha256-1+ua0ggXlYYPLTmMl3YeYYsBXDSCqT+Gw3u6l4gvMhA=",
|
||||
"lastModified": 1718437845,
|
||||
"narHash": "sha256-ZT7Oc1g4I4pHVGGjQFnewFVDRLH5cIZhEzODLz9YXeY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9b5328b7f761a7bbdc0e332ac4cf076a3eedb89b",
|
||||
"rev": "752c634c09ceb50c45e751f8791cb45cb3d46c9e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -761,11 +761,11 @@
|
|||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1718428119,
|
||||
"narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
|
||||
"lastModified": 1718606988,
|
||||
"narHash": "sha256-pmjP5ePc1jz+Okona3HxD7AYT0wbrCwm9bXAlj08nDM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
|
||||
"rev": "38d3352a65ac9d621b0cd3074d3bef27199ff78f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -793,11 +793,11 @@
|
|||
},
|
||||
"nixpkgs_8": {
|
||||
"locked": {
|
||||
"lastModified": 1718318537,
|
||||
"narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=",
|
||||
"lastModified": 1718530797,
|
||||
"narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420",
|
||||
"rev": "b60ebf54c15553b393d144357375ea956f89e9a9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1169,11 +1169,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718624172,
|
||||
"narHash": "sha256-ZWrhjpNX6WSdjnSV8/JTaSLLqY4VqRp9ql16DldcGYk=",
|
||||
"lastModified": 1718673535,
|
||||
"narHash": "sha256-KCHMePFrijSscQt6A4rtRJxciOaQXgHyGpqi9dzdy8E=",
|
||||
"owner": "Cloudef",
|
||||
"repo": "zig2nix",
|
||||
"rev": "26b1364329ffb4c910da43c53f6be27b140723de",
|
||||
"rev": "60a6e8d97759da986a488528d86548f611c89edb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1193,11 +1193,11 @@
|
|||
"zig-overlay": "zig-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718570415,
|
||||
"narHash": "sha256-VT5dPbvU/R90kU53OTa8gjynGU98o/QxGHzoP03g0IU=",
|
||||
"lastModified": 1718724404,
|
||||
"narHash": "sha256-BnXu0u0H74cyVOEneESQoCqMCf9zgSrkSx2QVuYztVY=",
|
||||
"owner": "zigtools",
|
||||
"repo": "zls",
|
||||
"rev": "2f7343e37e7647c7d44dfce83c2339861ab810c3",
|
||||
"rev": "cfea2d55798418cccdf27b1b1bde0f70bff1b8f2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -17,9 +17,11 @@ in
|
|||
nativeBuildInputs = [
|
||||
pkgs.pixi
|
||||
pkgs.swww
|
||||
pkgs.xdg-desktop-portal-hyprland
|
||||
pkgs.nixVersions.stable
|
||||
|
||||
inputs.hyprland.packages.${pkgs.system}.default
|
||||
inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland
|
||||
|
||||
inputs.tsm.packages.${pkgs.system}.default
|
||||
inputs.hyprman.packages.${pkgs.system}.default
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ let
|
|||
../modules/oizys.nix
|
||||
../overlays
|
||||
inputs.lix-module.nixosModules.default
|
||||
inputs.hyprland.nixosModules.default
|
||||
] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostName}"));
|
||||
specialArgs = {
|
||||
inherit
|
||||
|
@ -53,9 +54,9 @@ in
|
|||
nixosModules = listToAttrs (findModulesList ../modules);
|
||||
nixosConfigurations = mapAttrs (name: _: mkSystem name) (readDir ../hosts);
|
||||
packages = forAllSystems (pkgs: rec {
|
||||
oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { inherit zig2nix; };
|
||||
oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { };
|
||||
oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { };
|
||||
# oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { inherit zig2nix; };
|
||||
# oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { };
|
||||
# oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { };
|
||||
oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { inherit self lib; };
|
||||
default = oizys-go;
|
||||
});
|
||||
|
|
|
@ -6,18 +6,11 @@
|
|||
enabled,
|
||||
...
|
||||
}:
|
||||
# let
|
||||
# lock = pkgs.writeShellApplication {
|
||||
# name = "lock";
|
||||
# runtimeInputs = with pkgs; [swaylock];
|
||||
# text = ''
|
||||
# swaylock -c 1e1e2e
|
||||
# '';
|
||||
# };
|
||||
|
||||
mkOizysModule config "hyprland" {
|
||||
programs.hyprland = enabled // {
|
||||
package = inputs.hyprland.packages.${pkgs.system}.default;
|
||||
};
|
||||
programs.hyprland = enabled; #// {
|
||||
# package = inputs.hyprland.packages.${pkgs.system}.default;
|
||||
# };
|
||||
security.pam.services.swaylock = { };
|
||||
# Optional, hint electron apps to use wayland:
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
|
|
@ -14,6 +14,8 @@ var outputCmd = &cobra.Command{
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(outputCmd)
|
||||
outputCmd.Flags().BoolVar(&systemPath, "system-path", false, "show system-path drv")
|
||||
}
|
||||
|
|
|
@ -27,11 +27,12 @@ func Execute() {
|
|||
}
|
||||
|
||||
var (
|
||||
flake string
|
||||
host string
|
||||
cacheName string
|
||||
verbose bool
|
||||
nom bool
|
||||
flake string
|
||||
host string
|
||||
cacheName string
|
||||
verbose bool
|
||||
nom bool
|
||||
systemPath bool
|
||||
)
|
||||
|
||||
var oizys = o.NewOizys()
|
||||
|
@ -40,7 +41,7 @@ var rootCmd = &cobra.Command{
|
|||
Use: "oizys",
|
||||
Short: "nix begat oizys",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
oizys.Set(flake, host, cacheName, verbose)
|
||||
oizys.Set(flake, host, cacheName, verbose, systemPath)
|
||||
oizys.CheckFlake()
|
||||
},
|
||||
}
|
||||
|
|
|
@ -19,10 +19,11 @@ import (
|
|||
|
||||
// verbose vs debug?
|
||||
type Oizys struct {
|
||||
flake string
|
||||
host string
|
||||
cache string
|
||||
verbose bool
|
||||
flake string
|
||||
host string
|
||||
cache string
|
||||
verbose bool
|
||||
systemPath bool
|
||||
}
|
||||
|
||||
func NewOizys() *Oizys {
|
||||
|
@ -42,7 +43,44 @@ func NewOizys() *Oizys {
|
|||
return &Oizys{flake: flake, host: hostname, cache: "daylin"}
|
||||
}
|
||||
|
||||
func (o *Oizys) Output() string {
|
||||
type Derivation struct {
|
||||
InputDrvs map[string]interface{}
|
||||
}
|
||||
|
||||
func parseSystemPath(derivation map[string]Derivation) (string, error) {
|
||||
for _, nixosDrv := range derivation {
|
||||
for drv := range nixosDrv.InputDrvs {
|
||||
if strings.HasSuffix(drv, "system-path.drv") {
|
||||
return drv, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", errors.New("failed to find path for system-path.drv")
|
||||
}
|
||||
|
||||
// recreating this command
|
||||
// nix derivation show `oizys output` | jq -r '.[].inputDrvs | with_entries(select(.key|match("system-path";"i"))) | keys | .[]'
|
||||
func (o *Oizys) getSystemPath() string {
|
||||
cmd := exec.Command("nix", "derivation", "show", o.nixosConfigAttr())
|
||||
log.Println("evaluating to get system-path")
|
||||
cmd.Stderr = os.Stderr
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var derivation map[string]Derivation
|
||||
if err := json.Unmarshal(out, &derivation); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
systemPath, err := parseSystemPath(derivation)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return systemPath
|
||||
}
|
||||
|
||||
func (o *Oizys) nixosConfigAttr() string {
|
||||
return fmt.Sprintf(
|
||||
"%s#nixosConfigurations.%s.config.system.build.toplevel",
|
||||
o.flake,
|
||||
|
@ -50,9 +88,17 @@ func (o *Oizys) Output() string {
|
|||
)
|
||||
}
|
||||
|
||||
func (o *Oizys) Output() string {
|
||||
if o.systemPath {
|
||||
return o.getSystemPath()
|
||||
} else {
|
||||
return o.nixosConfigAttr()
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Oizys) Set(
|
||||
flake, host, cache string,
|
||||
verbose bool,
|
||||
verbose, systemPath bool,
|
||||
) {
|
||||
if host != "" {
|
||||
o.host = host
|
||||
|
@ -64,6 +110,7 @@ func (o *Oizys) Set(
|
|||
o.cache = cache
|
||||
}
|
||||
o.verbose = verbose
|
||||
o.systemPath = systemPath
|
||||
}
|
||||
|
||||
func terminalSize() (int, int) {
|
||||
|
@ -153,7 +200,11 @@ func (o *Oizys) git(rest ...string) *exec.Cmd {
|
|||
}
|
||||
|
||||
func showFailedOutput(buf []byte) {
|
||||
arrow := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("9")).Render("->")
|
||||
arrow := lipgloss.
|
||||
NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("9")).
|
||||
Render("->")
|
||||
for _, line := range strings.Split(strings.TrimSpace(string(buf)), "\n") {
|
||||
fmt.Println(arrow, line)
|
||||
}
|
||||
|
@ -208,7 +259,7 @@ func showDryRunResult(nixOutput string, verbose bool) {
|
|||
|
||||
func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
|
||||
args := []string{
|
||||
"build", o.Output(), "--dry-run",
|
||||
"build", o.nixosConfigAttr(), "--dry-run",
|
||||
}
|
||||
args = append(args, rest...)
|
||||
cmd := exec.Command("nix", args...)
|
||||
|
@ -302,7 +353,7 @@ func (o *Oizys) Checks(nom bool, rest ...string) {
|
|||
func (o *Oizys) CacheBuild(rest ...string) {
|
||||
args := []string{
|
||||
"watch-exec", o.cache, "--", "nix",
|
||||
"build", o.Output(), "--print-build-logs",
|
||||
"build", o.nixosConfigAttr(), "--print-build-logs",
|
||||
"--accept-flake-config",
|
||||
}
|
||||
args = append(args, rest...)
|
||||
|
@ -325,14 +376,6 @@ func (o *Oizys) CI(rest ...string) {
|
|||
runCommand(cmd)
|
||||
}
|
||||
|
||||
func Output(flake string, host string) string {
|
||||
return fmt.Sprintf(
|
||||
"%s#nixosConfigurations.%s.config.system.build.toplevel",
|
||||
flake,
|
||||
host,
|
||||
)
|
||||
}
|
||||
|
||||
func nixSpinner(host string) *spinner.Spinner {
|
||||
msg := fmt.Sprintf("%s %s", " evaluating derivation for:",
|
||||
lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("6")).Render(host),
|
||||
|
|
Loading…
Reference in a new issue