Skip to content

Commit b929b47

Browse files
authored
Merge pull request #198 from nix-community/updates
update our flakes.
2 parents a3c87bb + d068994 commit b929b47

35 files changed

+281
-271
lines changed

flake.lock

Lines changed: 26 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
inputs.systems.follows = "systems";
1010
};
1111
systems.url = "github:nix-systems/default";
12-
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
12+
nixpkgs.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixpkgs-unstable";
1313
flake-utils.url = "github:numtide/flake-utils";
1414
flake-utils.inputs.systems.follows = "systems";
1515
treefmt-nix = {

pkg/build/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ var (
1010
// It is set via Nix to match the Nixpkgs system.
1111
System = ""
1212
// ReportVersion is used to indicate significant changes in the report output and is embedded JSON report produced.
13-
ReportVersion uint = 1
13+
ReportVersion uint16 = 1
1414
)

pkg/facter/facter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
type Report struct {
1818
// Version is a monotonically increasing number,
1919
// used to indicate breaking changes or new features in the report output.
20-
Version uint `json:"version"`
20+
Version uint16 `json:"version"`
2121

2222
// System indicates the system architecture e.g. x86_64-linux.
2323
System string `json:"system"`

pkg/hwinfo/detail.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ func NewDetail(detail *C.hd_detail_t) (Detail, error) {
9090
}
9191

9292
type MemoryRange struct {
93-
Start uint `json:"start"`
94-
Size uint `json:"size"`
93+
Start string `json:"start"`
94+
Size string `json:"size"`
9595
Data string `json:"-"` // hex encoded
9696
}
9797

9898
func NewMemoryRange(mem C.memory_range_t) MemoryRange {
9999
return MemoryRange{
100-
Start: uint(mem.start),
101-
Size: uint(mem.size),
100+
Start: fmt.Sprintf("0x%x", uint(mem.start)),
101+
Size: fmt.Sprintf("0x%x", uint(mem.size)),
102102
Data: hex.EncodeToString(C.GoBytes(unsafe.Pointer(&mem.data), C.int(mem.size))), //nolint:gocritic
103103
}
104104
}

pkg/hwinfo/detail_bios.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ bool bios_info_has_lba_support(bios_info_t *info) { return info->lba_support; }
1313
import "C"
1414

1515
type ApmInfo struct {
16-
Supported bool `json:"supported"`
17-
Enabled bool `json:"enabled"`
18-
Version uint `json:"version"`
19-
SubVersion uint `json:"sub_version"`
20-
BiosFlags uint `json:"bios_flags"`
16+
Supported bool `json:"supported"`
17+
Enabled bool `json:"enabled"`
18+
Version uint8 `json:"version"`
19+
SubVersion uint8 `json:"sub_version"`
20+
BiosFlags uint32 `json:"bios_flags"`
2121
}
2222

2323
type VbeInfo struct {
24-
Version uint `json:"version"`
25-
VideoMemory uint `json:"video_memory"`
24+
Version uint16 `json:"version"`
25+
VideoMemory uint32 `json:"video_memory"`
2626
}
2727

2828
type DetailBios struct {
@@ -31,14 +31,14 @@ type DetailBios struct {
3131
VbeInfo VbeInfo `json:"vbe_info"`
3232

3333
// todo par and ser ports
34-
PnP bool `json:"pnp"`
35-
PnPId uint `json:"pnp_id"` // it is still in big endian format
36-
LbaSupport bool `json:"lba_support"`
37-
LowMemorySize uint `json:"low_memory_size"`
34+
PnP bool `json:"pnp"`
35+
PnPId uint `json:"pnp_id"` // it is still in big endian format
36+
LbaSupport bool `json:"lba_support"`
37+
LowMemorySize uint32 `json:"low_memory_size"`
3838
// todo smp info
3939
// todo vbe info
4040

41-
SmbiosVersion uint `json:"smbios_version"`
41+
SmbiosVersion uint32 `json:"smbios_version"`
4242

4343
// todo lcd
4444
// todo mouse
@@ -58,18 +58,18 @@ func NewDetailBios(dev C.hd_detail_bios_t) (*DetailBios, error) {
5858
ApmInfo: ApmInfo{
5959
Supported: bool(C.bios_info_is_apm_supported(data)),
6060
Enabled: bool(C.bios_info_is_apm_enabled(data)),
61-
Version: uint(data.apm_ver),
62-
SubVersion: uint(data.apm_subver),
63-
BiosFlags: uint(data.apm_bios_flags),
61+
Version: uint8(data.apm_ver),
62+
SubVersion: uint8(data.apm_subver),
63+
BiosFlags: uint32(data.apm_bios_flags),
6464
},
6565
VbeInfo: VbeInfo{
66-
Version: uint(data.vbe_ver),
67-
VideoMemory: uint(data.vbe_video_mem),
66+
Version: uint16(data.vbe_ver),
67+
VideoMemory: uint32(data.vbe_video_mem),
6868
},
6969
PnP: bool(C.bios_info_is_pnp_bios(data)),
7070
PnPId: uint(data.pnp_id),
7171
LbaSupport: bool(C.bios_info_has_lba_support(data)),
72-
LowMemorySize: uint(data.low_mem_size),
73-
SmbiosVersion: uint(data.smbios_ver),
72+
LowMemorySize: uint32(data.low_mem_size),
73+
SmbiosVersion: uint32(data.smbios_ver),
7474
}, nil
7575
}

pkg/hwinfo/detail_cpu.go

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ bool cpu_info_fpu_exception(cpu_info_t *info) { return info->fpu_exception; }
1010
bool cpu_info_write_protect(cpu_info_t *info) { return info->write_protect; }
1111
*/
1212
import "C"
13-
import "regexp"
13+
14+
import (
15+
"fmt"
16+
"regexp"
17+
)
1418

1519
//go:generate enumer -type=CPUArch -json -transform=snake -trimprefix CPUArch -output=./detail_enum_cpu_arch.go
1620
type CPUArch uint //nolint:recvcheck
@@ -36,8 +40,8 @@ const (
3640
)
3741

3842
type AddressSizes struct {
39-
Physical uint `json:"physical,omitempty"`
40-
Virtual uint `json:"virtual,omitempty"`
43+
Physical string `json:"physical,omitempty"`
44+
Virtual string `json:"virtual,omitempty"`
4145
}
4246

4347
type DetailCPU struct {
@@ -48,9 +52,9 @@ type DetailCPU struct {
4852
VendorName string `json:"vendor_name,omitempty"`
4953
ModelName string `json:"model_name,omitempty"`
5054

51-
Family uint `json:"family"`
52-
Model uint `json:"model"`
53-
Stepping uint `json:"stepping"`
55+
Family uint16 `json:"family"`
56+
Model uint16 `json:"model"`
57+
Stepping uint32 `json:"stepping"`
5458

5559
Platform string `json:"platform,omitempty"`
5660

@@ -59,21 +63,21 @@ type DetailCPU struct {
5963
PowerManagement []string `json:"power_management,omitempty"`
6064

6165
Bogo float64 `json:"bogo"`
62-
Cache uint `json:"cache,omitempty"`
63-
Units uint `json:"units,omitempty"`
66+
Cache uint32 `json:"cache,omitempty"`
67+
Units uint32 `json:"units,omitempty"`
6468
Clock uint `json:"-"`
6569

6670
// x86 only fields
67-
PhysicalID uint `json:"physical_id"`
68-
Siblings uint `json:"siblings,omitempty"`
69-
Cores uint `json:"cores,omitempty"`
70-
CoreID uint `json:"-"`
71+
PhysicalID uint16 `json:"physical_id"`
72+
Siblings uint16 `json:"siblings,omitempty"`
73+
Cores uint16 `json:"cores,omitempty"`
74+
CoreID uint16 `json:"-"`
7175
Fpu bool `json:"fpu"`
7276
FpuException bool `json:"fpu_exception"`
73-
CpuidLevel uint `json:"cpuid_level,omitempty"`
77+
CpuidLevel uint8 `json:"cpuid_level,omitempty"`
7478
WriteProtect bool `json:"write_protect"`
75-
TlbSize uint `json:"tlb_size,omitempty"`
76-
ClflushSize uint `json:"clflush_size,omitempty"`
79+
TlbSize uint16 `json:"tlb_size,omitempty"`
80+
ClflushSize uint16 `json:"clflush_size,omitempty"`
7781
CacheAlignment int `json:"cache_alignment,omitempty"`
7882
AddressSizes AddressSizes `json:"address_sizes,omitempty"`
7983
Apicid uint `json:"-"`
@@ -97,9 +101,9 @@ func NewDetailCPU(cpu C.hd_detail_cpu_t) (*DetailCPU, error) {
97101
VendorName: C.GoString(data.vend_name),
98102
ModelName: stripCPUFreq(C.GoString(data.model_name)),
99103

100-
Family: uint(data.family),
101-
Model: uint(data.model),
102-
Stepping: uint(data.stepping),
104+
Family: uint16(data.family),
105+
Model: uint16(data.model),
106+
Stepping: uint32(data.stepping),
103107

104108
Platform: C.GoString(data.platform),
105109

@@ -109,25 +113,25 @@ func NewDetailCPU(cpu C.hd_detail_cpu_t) (*DetailCPU, error) {
109113

110114
Clock: uint(data.clock),
111115
Bogo: float64(data.bogo),
112-
Cache: uint(data.cache),
113-
Units: uint(data.units),
116+
Cache: uint32(data.cache),
117+
Units: uint32(data.units),
114118

115-
PhysicalID: uint(data.physical_id),
116-
Siblings: uint(data.siblings),
117-
Cores: uint(data.cores),
118-
CoreID: uint(data.core_id),
119+
PhysicalID: uint16(data.physical_id),
120+
Siblings: uint16(data.siblings),
121+
Cores: uint16(data.cores),
122+
CoreID: uint16(data.core_id),
119123
Apicid: uint(data.apicid),
120124
ApicidInitial: uint(data.apicid_initial),
121125
Fpu: bool(C.cpu_info_fpu(data)),
122126
FpuException: bool(C.cpu_info_fpu_exception(data)),
123-
CpuidLevel: uint(data.cpuid_level),
127+
CpuidLevel: uint8(data.cpuid_level),
124128
WriteProtect: bool(C.cpu_info_write_protect(data)),
125-
TlbSize: uint(data.tlb_size),
126-
ClflushSize: uint(data.clflush_size),
129+
TlbSize: uint16(data.tlb_size),
130+
ClflushSize: uint16(data.clflush_size),
127131
CacheAlignment: int(data.cache_alignment),
128132
AddressSizes: AddressSizes{
129-
Physical: uint(data.address_size_physical),
130-
Virtual: uint(data.address_size_virtual),
133+
Physical: fmt.Sprintf("0x%x", uint(data.address_size_physical)),
134+
Virtual: fmt.Sprintf("0x%x", uint(data.address_size_virtual)),
131135
},
132136
}, nil
133137
}

pkg/hwinfo/detail_isa_pnp_dev.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ func NewIsaPnpCard(card *C.isapnp_card_t) (*IsaPnpCard, error) {
6464
type DetailIsaPnpDevice struct {
6565
Type DetailType `json:"-"`
6666
Card *IsaPnpCard `json:"card"`
67-
Device int `json:"device"`
68-
Flags uint `json:"flags"`
67+
Device uint32 `json:"device"`
68+
Flags uint32 `json:"flags"`
6969
}
7070

7171
func (d DetailIsaPnpDevice) DetailType() DetailType {
@@ -83,7 +83,7 @@ func NewDetailIsaPnpDevice(pnp C.hd_detail_isapnp_t) (*DetailIsaPnpDevice, error
8383
return &DetailIsaPnpDevice{
8484
Type: DetailTypeIsaPnp,
8585
Card: card,
86-
Device: int(data.dev),
87-
Flags: uint(data.flags),
86+
Device: uint32(data.dev),
87+
Flags: uint32(data.flags),
8888
}, nil
8989
}

0 commit comments

Comments
 (0)