mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-12 18:43:15 -06:00
Compare commits
1 commit
79984d5ddc
...
ac49626118
Author | SHA1 | Date | |
---|---|---|---|
ac49626118 |
11 changed files with 92 additions and 76 deletions
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
|
@ -57,6 +57,7 @@ jobs:
|
|||
build --minimal \
|
||||
--host "${{ inputs.hosts }}" \
|
||||
--flake . \
|
||||
--verbose \
|
||||
--debug \
|
||||
-- \
|
||||
--print-build-logs
|
||||
|
|
5
.github/workflows/update.yml
vendored
5
.github/workflows/update.yml
vendored
|
@ -22,7 +22,6 @@ jobs:
|
|||
|
||||
- uses: DeterminateSystems/nix-installer-action@v13
|
||||
with:
|
||||
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
|
||||
extra-conf: |
|
||||
accept-flake-config = true
|
||||
|
||||
|
@ -44,6 +43,7 @@ jobs:
|
|||
build --minimal \
|
||||
--host "othalan" \
|
||||
--flake . \
|
||||
--verbose \
|
||||
--debug \
|
||||
-- \
|
||||
--print-build-logs
|
||||
|
@ -86,6 +86,7 @@ jobs:
|
|||
-- \
|
||||
build $system_attr \
|
||||
--flake . \
|
||||
--verbose \
|
||||
--debug \
|
||||
-- \
|
||||
--print-build-logs \
|
||||
|
@ -100,9 +101,9 @@ jobs:
|
|||
-- \
|
||||
build $system_attr \
|
||||
--flake . \
|
||||
--verbose \
|
||||
--debug \
|
||||
-- \
|
||||
--keep-going \
|
||||
--print-build-logs \
|
||||
--out-link updated
|
||||
|
||||
|
|
46
flake.lock
46
flake.lock
|
@ -341,11 +341,11 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722956902,
|
||||
"narHash": "sha256-g3cAlVmRtnyqMZw88MKqVNM8eU88XzgNAlXdTkym5q8=",
|
||||
"lastModified": 1722880701,
|
||||
"narHash": "sha256-hAGsRq9YIuT6lC8p1ukd5uDRjgpjCcVb9PxrdNeO3jE=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "b0a70f63e3865eaa77f0b78a04b230aa583bc95c",
|
||||
"revCount": 5055,
|
||||
"rev": "0e86808e5912823f1c6bea1b6d5fcae297fc9f57",
|
||||
"revCount": 5052,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "https://github.com/hyprwm/Hyprland/"
|
||||
|
@ -534,11 +534,11 @@
|
|||
"lix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1722957485,
|
||||
"narHash": "sha256-cEemTAXvhRcjn7XxujIRglqEfAFgdlNulkRSFskowbo=",
|
||||
"rev": "f84997cbefb2f2dd99e48f0ad39f747ed83d69e9",
|
||||
"lastModified": 1722643724,
|
||||
"narHash": "sha256-FrM0DN/i5kKB06/4KYNkY3mMGpC5hYQhaKtx1mneReU=",
|
||||
"rev": "66469fc281fc4abb3284574f77a8051fee8116b9",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/f84997cbefb2f2dd99e48f0ad39f747ed83d69e9.tar.gz"
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/66469fc281fc4abb3284574f77a8051fee8116b9.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
|
@ -715,11 +715,11 @@
|
|||
"nixpkgs": "nixpkgs_6"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722928655,
|
||||
"narHash": "sha256-2BAfUaRzrhHwT/JodTq++DUf/nljgoFEc5A79SS8ydU=",
|
||||
"lastModified": 1722889110,
|
||||
"narHash": "sha256-hwwKU6Ml5i8I6aBmEWsddz+fm7D0r56d3A9IoGD1qlM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs-wayland",
|
||||
"rev": "423d21c157c2a7b384ae9c766e25759576dceb87",
|
||||
"rev": "f6cda1512287fa498bd363c0ae80e87606254cfb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -762,11 +762,11 @@
|
|||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1722926584,
|
||||
"narHash": "sha256-sLA+lfCxTkXf4o3JVxcfe+w9kAzauGfEnJ9roNbNng8=",
|
||||
"lastModified": 1722802969,
|
||||
"narHash": "sha256-bPhyAXNnVerBZusxOuPMhMm0X7hSFLFKcH+7ynfgLjs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d33cf80b603b3d0cddb48f9816cae707a59e2334",
|
||||
"rev": "785feb91183a50959823ff9ba9ef673105259cd5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -794,11 +794,11 @@
|
|||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1722813957,
|
||||
"narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=",
|
||||
"lastModified": 1722630782,
|
||||
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa",
|
||||
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1156,11 +1156,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722907357,
|
||||
"narHash": "sha256-alp8wfWJtxLXKNuVXPjhWFtrGhp10/3Nle//1RkapgU=",
|
||||
"lastModified": 1722820746,
|
||||
"narHash": "sha256-WWaaNV8mv4SjLsohrBxGbgVVjSLPJNazQiQL/zqxaLM=",
|
||||
"owner": "Cloudef",
|
||||
"repo": "zig2nix",
|
||||
"rev": "32c6285061bbab4920b020ec9e9f4aa5c9a81750",
|
||||
"rev": "9a3a862bf6b89bc77f2add620678b120b22c34bc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1180,11 +1180,11 @@
|
|||
"zig-overlay": "zig-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722919037,
|
||||
"narHash": "sha256-h8BG+XOCli8++tCojSo/cF39AIixVj3mO94b4cuqT94=",
|
||||
"lastModified": 1722891504,
|
||||
"narHash": "sha256-TlP+tlSAZTaJaulS2qEIaaQcJ7/z+mFs/cNTv+ccbzM=",
|
||||
"owner": "zigtools",
|
||||
"repo": "zls",
|
||||
"rev": "74b5a00f67ab4e5a848646411779221e6cc24b87",
|
||||
"rev": "f2f5339370cf166d75be9b220b9553396543c83c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
49
flake.nix
49
flake.nix
|
@ -8,7 +8,10 @@
|
|||
stable.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
||||
nixos-wsl.url = "github:nix-community/NixOS-WSL";
|
||||
nix-index-database.url = "github:nix-community/nix-index-database";
|
||||
nix-index-database = {
|
||||
url = "github:nix-community/nix-index-database";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
lix.url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
|
||||
lix.flake = false;
|
||||
|
@ -20,23 +23,37 @@
|
|||
|
||||
hyprland.url = "git+https://github.com/hyprwm/Hyprland/?submodules=1";
|
||||
hyprland-contrib.url = "github:hyprwm/contrib";
|
||||
roc.url = "github:roc-lang/roc";
|
||||
zig2nix.url = "github:Cloudef/zig2nix";
|
||||
zls.url = "github:zigtools/zls";
|
||||
|
||||
pixi.url = "github:daylinmorgan/pixi-flake";
|
||||
f1multiviewer.url = "github:daylinmorgan/f1multiviewer-flake";
|
||||
tsm.url = "github:daylinmorgan/tsm?dir=nix";
|
||||
hyprman.url = "git+https://git.dayl.in/daylin/hyprman.git";
|
||||
zig2nix = {
|
||||
url = "github:Cloudef/zig2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
zls = {
|
||||
url = "github:zigtools/zls";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
hyprman.inputs.nixpkgs.follows = "nixpkgs";
|
||||
f1multiviewer.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
|
||||
pixi.inputs.nixpkgs.follows = "nixpkgs";
|
||||
roc.inputs.nixpkgs.follows = "nixpkgs";
|
||||
tsm.inputs.nixpkgs.follows = "nixpkgs";
|
||||
zls.inputs.nixpkgs.follows = "nixpkgs";
|
||||
zig2nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
roc = {
|
||||
url = "github:roc-lang/roc";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
pixi = {
|
||||
url = "github:daylinmorgan/pixi-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
f1multiviewer = {
|
||||
url = "github:daylinmorgan/f1multiviewer-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
tsm = {
|
||||
url = "github:daylinmorgan/tsm?dir=nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
hyprman = {
|
||||
url = "git+https://git.dayl.in/daylin/hyprman.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
|
|
|
@ -14,29 +14,18 @@ in
|
|||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
# nix.package = pkgs.nixVersions.latest;
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
use-xdg-base-directories = true
|
||||
'';
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
use-xdg-base-directories = true
|
||||
'';
|
||||
|
||||
optimise.automatic = true;
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# use the same nixpkgs for nix run "nixpkgs#hello" style commands
|
||||
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
nix.optimise.automatic = true;
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html#_nix-shell_vs_nix_shell
|
||||
# use the same nixpkgs for nix-shell -p hello style commands
|
||||
# I don't know that this is necesary...
|
||||
# nix.nixPath = [ "nixpkgs=/etc/channels/nixpkgs" ];
|
||||
# environment.etc."channels/nixpkgs".source = inputs.nixpkgs.outPath;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.nixd
|
||||
pkgs.nixfmt-rfc-style
|
||||
|
|
|
@ -41,7 +41,7 @@ in
|
|||
|
||||
options.oizys = {
|
||||
user = mkOption {
|
||||
type = lib.types.str;
|
||||
type = lib.types.string;
|
||||
default = "daylin";
|
||||
description = "main user account";
|
||||
};
|
||||
|
|
|
@ -10,12 +10,10 @@ import (
|
|||
)
|
||||
|
||||
var validArgs = []string{
|
||||
"switch", "boot", "test", "build", "dry-build",
|
||||
"dry-activate", "edit", "repl",
|
||||
"switch", "boot", "test", "build", "dry-build", "dry-activate", "edit", "repl",
|
||||
"build-vm", "build-vm-with-bootloader",
|
||||
"list-generations",
|
||||
}
|
||||
|
||||
var osCmd = &cobra.Command{
|
||||
Use: "os [subcmd]",
|
||||
Short: "nixos-rebuild wrapper",
|
||||
|
@ -23,14 +21,11 @@ var osCmd = &cobra.Command{
|
|||
if err := cobra.MinimumNArgs(1)(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
// Run the custom validation logic
|
||||
if slices.Contains(validArgs, args[0]) {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf(
|
||||
"unexpected arg: %s\nexpected one of:\n %s",
|
||||
args[0],
|
||||
strings.Join(validArgs, ", "),
|
||||
)
|
||||
return fmt.Errorf("unexpected arg: %s\nexpected one of:\n %s", args[0], strings.Join(validArgs, ", "))
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
subcmd := args[0]
|
||||
|
|
|
@ -32,6 +32,7 @@ var (
|
|||
flake string
|
||||
host string
|
||||
debug bool
|
||||
verbose bool
|
||||
systemPath bool
|
||||
resetCache bool
|
||||
minimal bool
|
||||
|
@ -47,6 +48,7 @@ var rootCmd = &cobra.Command{
|
|||
}
|
||||
oizys.SetFlake(flake)
|
||||
oizys.SetHost(host)
|
||||
oizys.SetVerbose(verbose)
|
||||
oizys.SetResetCache(resetCache)
|
||||
oizys.SetDebug(debug)
|
||||
},
|
||||
|
@ -74,6 +76,7 @@ func init() {
|
|||
rootCmd.CompletionOptions.HiddenDefaultCmd = true
|
||||
rootCmd.PersistentFlags().StringVar(&flake, "flake", "", "path to flake ($OIZYS_DIR or $HOME/oizys)")
|
||||
rootCmd.PersistentFlags().StringVar(&host, "host", "", "host(s) to build (current host)")
|
||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "show verbose output")
|
||||
rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "show debug output")
|
||||
rootCmd.PersistentFlags().BoolVar(&resetCache, "reset-cache", false, "set narinfo-cache-negative-ttl to 0")
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ require (
|
|||
github.com/google/go-github/v63 v63.0.0
|
||||
github.com/ivanpirog/coloredcobra v1.0.1
|
||||
github.com/spf13/cobra v1.8.0
|
||||
golang.org/x/term v0.21.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -27,5 +28,4 @@ require (
|
|||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
||||
golang.org/x/sys v0.21.0 // indirect
|
||||
golang.org/x/term v0.21.0 // indirect
|
||||
)
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"oizys/internal/oizys"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/google/go-github/v63/github"
|
||||
|
@ -155,10 +154,17 @@ func ReadMarkdownFromZip(zipData []byte, fileName string) (string, error) {
|
|||
return string(content), nil
|
||||
}
|
||||
|
||||
// func CI(rest ...string) {
|
||||
// args := []string{
|
||||
// "workflow", "run", "build.yml",
|
||||
// "-F", fmt.Sprintf("hosts=%s", o.host),
|
||||
// }
|
||||
// args = append(args, rest...)
|
||||
// cmd := exec.Command("gh", args...)
|
||||
// e.ExitWithCommand(cmd)
|
||||
// }
|
||||
|
||||
func CreateDispatch(workflowFileName string, ref string, inputs map[string]interface{}) {
|
||||
if !strings.HasSuffix(workflowFileName, ".yml") && !strings.HasSuffix(workflowFileName, ".yaml") {
|
||||
workflowFileName = workflowFileName + ".yml"
|
||||
}
|
||||
log.Infof("creating dispatch event for %s", workflowFileName)
|
||||
event := github.CreateWorkflowDispatchEventRequest{Ref: ref, Inputs: inputs}
|
||||
_, err := client.Actions.CreateWorkflowDispatchEventByFileName(
|
||||
|
|
|
@ -35,6 +35,7 @@ type Oizys struct {
|
|||
githubToken string
|
||||
local bool
|
||||
inCI bool
|
||||
verbose bool
|
||||
systemPath bool
|
||||
resetCache bool
|
||||
debug bool
|
||||
|
@ -100,6 +101,9 @@ func SetHost(name string) {
|
|||
}
|
||||
|
||||
func GetHost() string { return o.host }
|
||||
func SetVerbose(v bool) {
|
||||
o.verbose = v
|
||||
}
|
||||
|
||||
func SetResetCache(reset bool) {
|
||||
o.resetCache = reset
|
||||
|
@ -237,7 +241,7 @@ func NixosRebuild(subcmd string, rest ...string) {
|
|||
if !o.inCI {
|
||||
cmd.Args = append(cmd.Args, "--log-format", "multiline")
|
||||
}
|
||||
if o.debug {
|
||||
if o.verbose {
|
||||
cmd.Args = append(cmd.Args, "--print-build-logs")
|
||||
}
|
||||
cmd.Args = append(cmd.Args, rest...)
|
||||
|
|
Loading…
Reference in a new issue