Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #284 from ublue-os/uniquesystems
Browse files Browse the repository at this point in the history
fix: unique arch-os combo in flake.nix
  • Loading branch information
castrojo authored Sep 21, 2023
2 parents 53bf327 + 4caaf0c commit 21ca0a8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/flake/templates/flake.nix.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
};

outputs = { self, nixpkgs, home-manager, fleek, ... }@inputs: {
{{ range .Config.Systems }}
packages.{{ .Arch }}-{{ .OS }}.fleek = fleek.packages.{{ .Arch }}-{{ .OS }}.default;
{{ range .Config.UniqueSystems }}
packages.{{ . }}.fleek = fleek.packages.{{ . }}.default;
{{ end }}
# Available through 'home-manager --flake .#your-username@your-hostname'
{{ $overlays := .Config.Overlays }}
Expand Down
16 changes: 16 additions & 0 deletions internal/fleek/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,22 @@ func isValueInList(value string, list []string) bool {
return false
}

func (c *Config) UniqueSystems() []string {
var m = make(map[string]bool)
var systems = []string{}

for _, sys := range c.Systems {
syskey := sys.Arch + "-" + sys.OS
if m[syskey] {
continue
}
systems = append(systems, syskey)
m[syskey] = true
}
return systems

}

func (c *Config) UserFlakeDir() string {
home, _ := os.UserHomeDir()
// if for some reason the flakedir key is
Expand Down

0 comments on commit 21ca0a8

Please sign in to comment.