mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-26 21:50:44 -06:00
Compare commits
No commits in common. "128ddc47a97cd7aec3678c627551cffc819b533c" and "77045fc4d2671bb27e72dd814bae6bc6d6590603" have entirely different histories.
128ddc47a9
...
77045fc4d2
10 changed files with 83 additions and 132 deletions
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
|
@ -20,6 +20,7 @@ on:
|
|||
default: 'othalan aligz'
|
||||
type: string
|
||||
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }}
|
||||
cancel-in-progress: true
|
||||
|
@ -33,10 +34,7 @@ jobs:
|
|||
|
||||
- uses: ./.github/actions/clean-disk
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@v12
|
||||
with:
|
||||
extra-conf: |
|
||||
accept-flake-config = true
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@v7
|
||||
|
||||
- uses: cachix/cachix-action@v15
|
||||
|
@ -53,6 +51,5 @@ jobs:
|
|||
- name: Build
|
||||
run: |
|
||||
for host in ${{ inputs.host }}; do
|
||||
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 .
|
||||
nix run . --accept-flake-config -- cache --host "$host" --flake .
|
||||
done
|
||||
|
|
12
.github/workflows/checks.yml
vendored
12
.github/workflows/checks.yml
vendored
|
@ -8,8 +8,12 @@ on:
|
|||
description: 'flake.lock file'
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -19,9 +23,6 @@ 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
|
||||
|
@ -37,5 +38,4 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cachix watch-exec daylin -- nix build '.#checks.x86_64-linux.makePackages'
|
||||
cachix watch-exec daylin -- nix build --accept-flake-config '.#checks.x86_64-linux.makePackages'
|
||||
|
|
14
.github/workflows/push.yml
vendored
14
.github/workflows/push.yml
vendored
|
@ -8,17 +8,13 @@ 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": 1718728970,
|
||||
"narHash": "sha256-R8FjmfsIrTUXMPtmjCNKeTR6cBMCY75WMnH5PfGXHFQ=",
|
||||
"lastModified": 1716316901,
|
||||
"narHash": "sha256-AWzUBSlgPVszYMk611mHgoHCA/hXjzos50KvKJfHCs8=",
|
||||
"owner": "daylinmorgan",
|
||||
"repo": "f1multiviewer-flake",
|
||||
"rev": "a04a548c5e88933a2aed21544d18812860f14212",
|
||||
"rev": "89653c7aa046dd23fd61b2ddae6c55725857b224",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -305,11 +305,11 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718723174,
|
||||
"narHash": "sha256-cPIOblG2H8Z934FPeuU0I6kI1Ke8ZbF330Nq/hTJ2uU=",
|
||||
"lastModified": 1718633685,
|
||||
"narHash": "sha256-dAuZ6mIIVQraN1PnCe12Qwdcs/Nvfe/zfSy45ED5aso=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "236150b3c5227bbfbe46d2610c739a386afdca1f",
|
||||
"revCount": 4859,
|
||||
"rev": "a9c7a0830fd9a8b9fc4065f1cd654efd1326691a",
|
||||
"revCount": 4856,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/hyprwm/Hyprland/"
|
||||
|
@ -630,11 +630,11 @@
|
|||
"nixpkgs": "nixpkgs_5"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718710563,
|
||||
"narHash": "sha256-O4rrM0Bkh3IRe8D600iniQ52QTmlnuTSp2KyXV7C2jE=",
|
||||
"lastModified": 1718470009,
|
||||
"narHash": "sha256-VBeDG3we0bkbFWMyZy+wjUkmeDN58pGFzw1dQCTeDV8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "2fb93bea657ad99a7005ef601c67cb2820560a41",
|
||||
"rev": "e0a970cbb8c3af05c80ef48a336ad91efd9b2bf6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -645,11 +645,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1718530797,
|
||||
"narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=",
|
||||
"lastModified": 1712163089,
|
||||
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b60ebf54c15553b393d144357375ea956f89e9a9",
|
||||
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -682,11 +682,11 @@
|
|||
"nixpkgs": "nixpkgs_8"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718727726,
|
||||
"narHash": "sha256-WIoMGbYpJMc9TTPeJeoGXRw5KaUkqDVMmtQp412ThOk=",
|
||||
"lastModified": 1718630464,
|
||||
"narHash": "sha256-GXuN6MmzNomxT9VOEFu4iwP1kRTJ7F3/HdOzeDGPE1c=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs-wayland",
|
||||
"rev": "7a80040b517fdfcf8a97749b58afc47bbea4b8c8",
|
||||
"rev": "4a3b27cc9526208686896d0ef01c7bb67a47b91f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -745,11 +745,11 @@
|
|||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1718437845,
|
||||
"narHash": "sha256-ZT7Oc1g4I4pHVGGjQFnewFVDRLH5cIZhEzODLz9YXeY=",
|
||||
"lastModified": 1717696253,
|
||||
"narHash": "sha256-1+ua0ggXlYYPLTmMl3YeYYsBXDSCqT+Gw3u6l4gvMhA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "752c634c09ceb50c45e751f8791cb45cb3d46c9e",
|
||||
"rev": "9b5328b7f761a7bbdc0e332ac4cf076a3eedb89b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -761,11 +761,11 @@
|
|||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1718606988,
|
||||
"narHash": "sha256-pmjP5ePc1jz+Okona3HxD7AYT0wbrCwm9bXAlj08nDM=",
|
||||
"lastModified": 1718428119,
|
||||
"narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "38d3352a65ac9d621b0cd3074d3bef27199ff78f",
|
||||
"rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -793,11 +793,11 @@
|
|||
},
|
||||
"nixpkgs_8": {
|
||||
"locked": {
|
||||
"lastModified": 1718530797,
|
||||
"narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=",
|
||||
"lastModified": 1718318537,
|
||||
"narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b60ebf54c15553b393d144357375ea956f89e9a9",
|
||||
"rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1169,11 +1169,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718673535,
|
||||
"narHash": "sha256-KCHMePFrijSscQt6A4rtRJxciOaQXgHyGpqi9dzdy8E=",
|
||||
"lastModified": 1718624172,
|
||||
"narHash": "sha256-ZWrhjpNX6WSdjnSV8/JTaSLLqY4VqRp9ql16DldcGYk=",
|
||||
"owner": "Cloudef",
|
||||
"repo": "zig2nix",
|
||||
"rev": "60a6e8d97759da986a488528d86548f611c89edb",
|
||||
"rev": "26b1364329ffb4c910da43c53f6be27b140723de",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1193,11 +1193,11 @@
|
|||
"zig-overlay": "zig-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718724404,
|
||||
"narHash": "sha256-BnXu0u0H74cyVOEneESQoCqMCf9zgSrkSx2QVuYztVY=",
|
||||
"lastModified": 1718570415,
|
||||
"narHash": "sha256-VT5dPbvU/R90kU53OTa8gjynGU98o/QxGHzoP03g0IU=",
|
||||
"owner": "zigtools",
|
||||
"repo": "zls",
|
||||
"rev": "cfea2d55798418cccdf27b1b1bde0f70bff1b8f2",
|
||||
"rev": "2f7343e37e7647c7d44dfce83c2339861ab810c3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -17,11 +17,9 @@ 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,7 +33,6 @@ let
|
|||
../modules/oizys.nix
|
||||
../overlays
|
||||
inputs.lix-module.nixosModules.default
|
||||
inputs.hyprland.nixosModules.default
|
||||
] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostName}"));
|
||||
specialArgs = {
|
||||
inherit
|
||||
|
@ -54,9 +53,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,11 +6,18 @@
|
|||
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,8 +14,6 @@ var outputCmd = &cobra.Command{
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(outputCmd)
|
||||
outputCmd.Flags().BoolVar(&systemPath, "system-path", false, "show system-path drv")
|
||||
}
|
||||
|
|
|
@ -27,12 +27,11 @@ func Execute() {
|
|||
}
|
||||
|
||||
var (
|
||||
flake string
|
||||
host string
|
||||
cacheName string
|
||||
verbose bool
|
||||
nom bool
|
||||
systemPath bool
|
||||
flake string
|
||||
host string
|
||||
cacheName string
|
||||
verbose bool
|
||||
nom bool
|
||||
)
|
||||
|
||||
var oizys = o.NewOizys()
|
||||
|
@ -41,7 +40,7 @@ var rootCmd = &cobra.Command{
|
|||
Use: "oizys",
|
||||
Short: "nix begat oizys",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
oizys.Set(flake, host, cacheName, verbose, systemPath)
|
||||
oizys.Set(flake, host, cacheName, verbose)
|
||||
oizys.CheckFlake()
|
||||
},
|
||||
}
|
||||
|
|
|
@ -19,11 +19,10 @@ import (
|
|||
|
||||
// verbose vs debug?
|
||||
type Oizys struct {
|
||||
flake string
|
||||
host string
|
||||
cache string
|
||||
verbose bool
|
||||
systemPath bool
|
||||
flake string
|
||||
host string
|
||||
cache string
|
||||
verbose bool
|
||||
}
|
||||
|
||||
func NewOizys() *Oizys {
|
||||
|
@ -43,44 +42,7 @@ func NewOizys() *Oizys {
|
|||
return &Oizys{flake: flake, host: hostname, cache: "daylin"}
|
||||
}
|
||||
|
||||
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 {
|
||||
func (o *Oizys) Output() string {
|
||||
return fmt.Sprintf(
|
||||
"%s#nixosConfigurations.%s.config.system.build.toplevel",
|
||||
o.flake,
|
||||
|
@ -88,17 +50,9 @@ func (o *Oizys) nixosConfigAttr() 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, systemPath bool,
|
||||
verbose bool,
|
||||
) {
|
||||
if host != "" {
|
||||
o.host = host
|
||||
|
@ -110,7 +64,6 @@ func (o *Oizys) Set(
|
|||
o.cache = cache
|
||||
}
|
||||
o.verbose = verbose
|
||||
o.systemPath = systemPath
|
||||
}
|
||||
|
||||
func terminalSize() (int, int) {
|
||||
|
@ -200,11 +153,7 @@ 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)
|
||||
}
|
||||
|
@ -259,7 +208,7 @@ func showDryRunResult(nixOutput string, verbose bool) {
|
|||
|
||||
func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
|
||||
args := []string{
|
||||
"build", o.nixosConfigAttr(), "--dry-run",
|
||||
"build", o.Output(), "--dry-run",
|
||||
}
|
||||
args = append(args, rest...)
|
||||
cmd := exec.Command("nix", args...)
|
||||
|
@ -353,7 +302,7 @@ func (o *Oizys) Checks(nom bool, rest ...string) {
|
|||
func (o *Oizys) CacheBuild(rest ...string) {
|
||||
args := []string{
|
||||
"watch-exec", o.cache, "--", "nix",
|
||||
"build", o.nixosConfigAttr(), "--print-build-logs",
|
||||
"build", o.Output(), "--print-build-logs",
|
||||
"--accept-flake-config",
|
||||
}
|
||||
args = append(args, rest...)
|
||||
|
@ -376,6 +325,14 @@ 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